|
Rank: Newbie Groups: Member
Joined: 10/17/2017 Posts: 5
|
Hi.
I'm encountering a memory exception when using ConvertUrl to convert an XML file (56mb) to PDF. Files of this size are an outlier, but they need to be handled all the same. I've just updated to version 24.0.49 in the hopes that it might have improved the situation, but unfortunately I'm still stuck.
I tried splitting the original file into smaller chunks and hoped I might've been able to convert each chunk to a separate PDF and then merge them together, but that conversion fails as well, presumably because each chunk holds invalid XML by not being able to close each tag properly (a tag might open in one chunk, but close in another). I've also tried disabling RetrieveNodeText. Same result.
I'm assuming that ConvertUrl's input needs to have valid XML in order to attempt to convert it, if that is the case, are there any other approaches I could take, or do you have any other ideas?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
It's unlikely that a file of this size will succeed. However splitting it into small files should work. ConvertUrl should be able to convert unclosed XML by automatically closing unclosed elements, even though it is always better for the XML to be already properly closed. So instead of just "slicing" the huge XML file into small chunks, you can use some kind of XML processing APIs such as XmlDocument or XSLT to generate properly formatted small XML files.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/17/2017 Posts: 5
|
I appreciate the feedback, but that solution is unfortunately not an option for us. We must not modify the XML structure, so the tags need to be opening/closing the way they currently are.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
You can share the file with us and we can take a look to see if we can find a solution for you. However there is no guarantee that there is one. If that's the case you must reduce the input file size.
|
|
Rank: Newbie Groups: Member
Joined: 10/17/2017 Posts: 5
|
I'll ask to have a sanitized version of the file. Where do I send it to?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
You can send it to us through our contact us page: https://www.essentialobjects.com/contact
|
|
Rank: Newbie Groups: Member
Joined: 10/17/2017 Posts: 5
|
I've tried to drag and drop the XML file as both a ZIP and a TXT, the contact page isn't accepting either. What else can I do to supply you with the offending XML?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
It should accept zip file. How big is the zip file?
|
|
Rank: Newbie Groups: Member
Joined: 10/17/2017 Posts: 5
|
It's 581KB. When I try and drag it, the Drag n Drop area just remains unresponsive.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
We have looked into the file you sent to us. It indeed cause out of memory exception in the browser engine and crashes the browser engine. Even Google Chrome browser is not able to load and display the file. It resulted in the same crash.
Because even Google Chrome crashes on the same file, it is not possible for us to load the file without running into the same issue. You will have to modify your input file to reduce the size. We see that your input XML is basically a large list of RouteRob element. So you can consider using this strategy:
1. Create a separate HTML file that represents the section of XML before the first RouteRob element; 2. Create multiple HTML files each represents a reasonable amount (for example, 1000) of RouteRob element; 3. Create another HTML file that represents the closing tag after the last RouteRob element;
You can then use a loop to convert all these HTML into a single PdfDocument while using HtmlToPdfOptions.Follow after reach conversion so that they will appear in the output PDF file directly one after another.
Hope this helps.
Thanks!
|
|