Problem with memory consumption in Aspose.Pdf

Hello,

if I embed large PNG files (6200x4500 pixels, size: about 45M) into a pdf file the memory consumption of Aspose rises up to 280M when calling Document.Save() (see the following code sample, last line):

Aspose.Pdf.Generator.Pdf Document = new Aspose.Pdf.Generator.Pdf();

Aspose.Pdf.Generator.Section Section = new Aspose.Pdf.Generator.Section();
Document.Sections.Add(Section);



Aspose.Pdf.Generator.Image Image = new Aspose.Pdf.Generator.Image(Section);
Image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png;
Image.ImageInfo.ImageStream = System.IO.File.OpenRead();
Section.Paragraphs.Add(Image);



Document.Save();


In our case the problem is that the memory consumption is too high…

Can you please tell me when this problem can be resolved?

Best regards,
Sacha End

Hi Sacha,


Thanks for contacting support and sorry for the delayed response.

I have tested the scenario using one of my sample image files and I did not notice any significant increase in memory consumption during Image to PDF conversion. I have used Resource Monitor to observe the memory consumption/utilization.

Can you please share the source Image file (you may upload it over FTP or some free file sharer) and also share some details regarding the steps that you are following to determine the memory utilization, so that we can again test the scenario at our end. We are sorry for your inconvenience.

Hello,

thank you for your answer. The source image file is available at

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>DE</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–>

http://dhc-upload.de/~upload/10939.png

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Normale Tabelle"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}
<![endif]–>

I determine the memory utilization with

GC.GetTotalMemory(false)

Best regards,
Sacha End

Hi Sacha,

Sorry for the inconvenience faced. I've managed to observe the memory consumption issue. For further investigation I've logged an issue in our issue tracking system as PDFNEWNET-34979 and also linked your request to it. We will keep you update via this thread regarding the issue status.

Please feel free to contact us for any further assistance.

Best Regards

Hi Sacha,


Thanks for your patience.

We have made some progress in terms of memory while converting Image files to PDF format. I would recommend you to try using the following (DOM) approach to convert Image files to PDF format.

[C#]

string outFile = “input.pdf”;<o:p></o:p>

string inFile = "source.png";

long size0 = GC.GetTotalMemory(false) / 1048576;

Document doc = new Document();

Page page = doc.Pages.Add();

Aspose.Pdf.Image img = new Aspose.Pdf.Image();

img.File = inFile;

page.Paragraphs.Add(img);

long size1 = GC.GetTotalMemory(false) / 1048576;

doc.Save(outFile);

long size2 = GC.GetTotalMemory(false) / 1048576;

Console.WriteLine(size0);

Console.WriteLine(size1);

Console.WriteLine(size2);

The issues you have found earlier (filed as PDFNEWNET-34979) have been fixed in Aspose.Pdf for .NET 7.8.0update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.