Free Support Forum - aspose.com

Convert TIFF to PDF using Aspose.PDF for .NET - Save Method Hangs forever

Hi,

I’m converting TIFF files to PDF. I’m having issues with some of the files when saving to PDF. I’m able to open the files and add them to a PDF.Document, but when I try to save memory usage goes to almost 100% and the process hangs forever. Please help. I’m using the latest version 18.1

Thanks,

Mario E.

@mestevez

Thanks for contacting support.

Would you please share your complete code snippet along with sample input file(s), so that we can test the scenario in our environment and address it accordingly.

Here you go.
FilesWithIssues.zip (135.0 KB)

I included the 4 files that I’m trying to combine into a single PDF file and a text file containing the VB code that I’m using.

@mestevez

Thanks for sharing requested files and code snippet.

I have narrowed down your code snippet, in order to test the scenario and found that problem was occurring due to setting Height and Width of the page according to image dimensions. Since you were setting page height/width same as of image and also setting the page margins, the API was unable to render the TIFF image inside PDF (because page width/height + margin values were higher than those of, you were setting in the code snippet) and taking time to save the document.

In case you want to generate PDF document with all side margin value as 5, you need to add this value for height and width of the PDF Pages as well (e.g Top Margin = 5, Bottom Margin = 5 => Height = imageHeight + 10). Modifying following lines of shared code snippet, have resolved the issue and an output PDF document is also attached for your reference.

currpage.PageInfo.Width = pWidth + 10
currpage.PageInfo.Height = pHeight + 10

Output_File

In case of any further assistance, please feel free to contact us.

Asad.Ali,

Thanks so much for your help. I removed the margins since I didn’t need to have them and everything seems to be working now. I appreciate your quick response.

Thanks,

Mario E.