Converting TIF to PDF

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

isaware
User
Posts: 39
Joined: Fri Sep 25, 2009 6:21 pm

Converting TIF to PDF

Post by isaware »

Hi,

I'm using the following codes to convert TIF to PDF (put TIF in PDF on certain position).
However, I'm hitting performance issue when I try to convert about 25,000 TIFs.

iResult = PDFXC_Funcs.PXC_NewDocument(out iPDFFile, XCPro40_Defs.g_RegKey, XCPro40_Defs.g_DevCode);
iResult = PDFXC_Funcs.PXC_AddImageW(iPDFFile, sTIFFilePath, out iPDFImage);
iResult = PDFXC_Funcs.PXC_GetImageDimension(iPDFFile, iPDFImage, out dWidth, out dHeight);
iResult = PDFXC_Funcs.PXC_AddPage(iPDFFile, 612, 520 + dHeight, out iPDFPage);
iResult = PDFXC_Funcs.PXC_PlaceImage(iPDFPage, iPDFImage, (612 - dWidth) / 2, 520, dWidth, dHeight);
iResult = PDFXC_Funcs.PXC_WriteDocumentExA(iPDFFile, sTIFFilePath.ToLower().Replace(".tif", ".pdf"), sTIFFilePath.ToLower().Replace(".tif", ".pdf").Length, 0, "");
iResult = PDFXC_Funcs.PXC_ReleaseDocument(iPDFFile);

Is there any other way or additional codes that may need to speed up the conversion?

Christina
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Converting TIF to PDF

Post by Lzcat - Tracker Supp »

Can you be more specific about your conversion process? Are you converting one tiff file to one pdf or multiple tiff to one file? And what exactly happens when you try to convert 2500 files?
Also, please make sure that you are using latest build (195 at the moment)
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
isaware
User
Posts: 39
Joined: Fri Sep 25, 2009 6:21 pm

Re: Converting TIF to PDF

Post by isaware »

It is always 1 TIF file to 1 PDF - 25,000 will converted to 25,000 PDF files.
I used the latest version 4.0.195.
It takes about 5 hours to process these 25,000 records.
Is there a way to speed up this process?
I provided the code I'm using in the previous post.

I ran this process in a smaller records - 1,000 and it takes about 15-17 minutes to convert them all.
The size of the TIF files are about 12-15kb.

Christina
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Converting TIF to PDF

Post by Tracker Supp-Stefan »

Hello Christina,

You are achieving a speed of 0.7 - 0.9 seconds per file, and I do think that this is not too bad.

Another thing is that you are reading from and writing to the same drive. Is this an SSD or a standard HDD?
If it is a regular HDD - reading from and writing to the same drive could be the biggest slow down you have, and if you have an access to an SSD with which you could test please do so as that could show if the drive performance is your bottleneck.

Best,
Stefan
isaware
User
Posts: 39
Joined: Fri Sep 25, 2009 6:21 pm

Re: Converting TIF to PDF

Post by isaware »

We would want to increase the speed of the process. Saying that it is not too bad is not an option..
Is there any functions/methods that may decrease the process time?
Is there a way to convert TIF stream to a PDF with certain position?

Christina
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Converting TIF to PDF

Post by Tracker Supp-Stefan »

Hello Christina,

I'm afraid there are no further optimizations in the SDK that could bring significant improvements in performance.
Our developers have finished for the week, so can I ask you to try to track the execution time for each of the commands you call in order to see which portion of your code takes longest to execute - I expect that you will see the PXC_AddImageW and the PXC_WriteDocumentExA would be the slowest.

Regards,
Stefan
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Converting TIF to PDF

Post by Lzcat - Tracker Supp »

Hi Christina.
I'm affraid that there is not so many possibilities to speedup, but you may try to do following:

1. Rewrite your code to use several threads (best case - one thread per CPU core). If you have quad-core CPU you will get up to four times the speed.

2. Disable your antivirus/firewall (and other similar software). This may seriously improve read/write performance, which may be a bottleneck.

If this helps - try to setup your AV/firewall to bypass your program requests.

Also, can you provide us one or two typical tiff files to investigate? I cannot promise that we can easily improve something, but there may be some tricks/tips we can offer.

HTH
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.