VBA Access Image Size and Resize Pages

I am writting a program that allows us to load all our old files from our archives and exports them out as PDFs and text files to load into our SQL database so we can search everything.  I have files dating back to Corel 5 which dont open in Corel 2019 so I loaded Corel X5 on my computer as well.  I have several questions.

#1, is there any API call to get the version of the File

#2 is there a way to recurse through the pages of the document do a select all on that page and get the page size.

#3 once i have the page size I will want to change the document paper size to match so that when it exports it doesnt cut off.

Does anyone know of such a method or can you point me in the right direction.



No Data
  • The information about the version is available in the CDR-File. But I have not yet a clue to read out this automatically.
    Maybe one other has more skills to automate the following steps:

    Method 1:
    If you go (at least under Win7 Pro, but most likely at least all newer windows versions) with the explorer to the folder where the files in question are located, do a right click (best thing on a free area, but not on the file name) in the head line and select 'ProductName', then you get a tag for each CDR-File with the Corel version used for this.

    Method 2: (more complicated, but provides even more information):
    You need a tool to un-compress packed files like 7-Zip or WinRar (with that I tested it), open in their File-Manager the folder with the CDR-Files in question and click on a CDR-File. Then you will see a sub folder structure with a folder called 'META-INF'. Go into this folder, inside you find a file Metadata.xml. Search there for '<cdr:ProductName>' and you will see the version behind.

    With that you have a – surly not really easy and fast – way to read out the 'ProductName' automatically:
    You need to have a tool installed on your PC where you may decompress a part of an archive with a command line interface. Although the Corel files are compressed with PKUnzip, other tools will work most likely as well. (I did similar actions with 7Zip, this comes by default with a CLI)
    Then you can create in VBA for each *.CDR-File a command line which advices the packer to extract from the CDR-'Archive' the file 'META-INF\metadata.xml' to somewhere on your PC. If this file is available, you can open it as a simple text file and search for <cdr:ProductName> and </cdr:ProductName> and cut out the part between and you have the needed information.

    One tip, if you want to follow this way: Do not send the command line directly with the VBA command 'Shell' to the operating system, write it in a small batch file and delete (with a line in the batch file) it afterwards. Then you can check after you started the batch file in VBA the presence of this file. As long as this file is available, the decompression isn't completed.

No Data