PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting Out of memory error while converting a dxl file Re: Re: Out of memory error while converting a dxl file

#29219

Hi ,

I am not sure where you want me to add the above portion of the code.Looking at the code it seems to be like you are creating the file in temp folder and adding some temprefrence tag to the html body.But after adding if you could give the details of what we need to do this return value it would be very helpful.
I also don’t want to store the file in temp loaction I just want to store the file in some file path other than temp folder.

I will also give the code snippet of what I currenlty do to convert DXL to PDF and to extract attachements from the converted PDF File.

I am using below method to conver the html to pdf.
pd4ml.render(new StringReader(inputHTML), fos, new URL("file:."), "utf-8");
The inputHTML for the above function is framed as below.The contents of the DXL file is XMl source and the Pd4ml.xsl as xsl soruce.The below function returns the html content needed to pass to the above render function.

try {<br /> java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();<br /> <br /> javax.xml.transform.Source xmlSource = new javax.xml.transform.stream.StreamSource(new StringReader(xml));<br /> javax.xml.transform.Source xsltSource = new javax.xml.transform.stream.StreamSource(new StringReader(xsl));<br /> javax.xml.transform.Result result = new javax.xml.transform.stream.StreamResult(baos);<br /> <br /> javax.xml.transform.TransformerFactory transFact = javax.xml.transform.TransformerFactory.newInstance();<br /> <br /> javax.xml.transform.Transformer trans = transFact.newTransformer(xsltSource);<br /> <br /> trans.transform(xmlSource, result);<br /> <br /> return baos.toString("utf-8");<br /> }

After the PDF file has been rendered I am extracting the attachement from that PDF file.

Kindly let me know if I have to do in some alrternate way.