Why Cannnot use InputStream in PdfContentEditor?


Hi, ASPOSE Support Stuffs,

I use Aspose.pdf.kit for Java 1.8.0.0.
and JDK is 1.5

I want to draw a line with
PdfContentEditor.
following source in pattern1 and pattern2 is execute normally.
However, error message is displayed when I carry out pattern 3, and processing does not return.

Cannot i use FileInputStream in PdfContentEditor?
and AsposePdfKitXXXXtmp is created.
What is this file?

I want to use PdfContentEditor in ByteArrayinputStream and ByteArrayOutputStream.

Thanking you in advance.

following is I tested source.
//----- create drawing line attributes
Rectangle rect=new Rectangle(50,50,200,200);
Color c=new Color(255,0,0);
int []dashArray={};
String []LEArray={};

//----- draw Line Pattern 1(In:FileName, Out:FileName)
try {
PdfContentEditor wC1 = new PdfContentEditor();
wC1.bindPdf(“C://temp//sample.pdf”);
wC1.createLine(rect, “”, 100, 100, 400, 100, 1, 5, “s”, dashArray, LEArray, c);
wC1.save(“C://temp//sample1.pdf”);
wC1 = null;

//----- draw Line Pattern 2(In:FileName, Out:FileOutputStream)
PdfContentEditor wC2 = new PdfContentEditor();
FileOutputStream wo2 = new FileOutputStream(“C://temp//sample2.pdf”);
wC2.bindPdf(“C://temp//sample.pdf”);
wC2.createLine(rect, “”, 100, 100, 400, 100, 1, 5, “s”, dashArray, LEArray, c);
wC2.save(wo2);
wo2.close();
wC2 = null;

//----- draw Line Pattern 3(In:FileInputStream, Out:FileName)
PdfContentEditor wC3 = new PdfContentEditor();
FileInputStream wi3 = new FileInputStream(“C://temp//sample.pdf”);
wC3.bindPdf(wi3);
wC3.createLine(rect, “”, 100, 100, 400, 100, 1, 5, “s”, dashArray, LEArray, c);
wC3.save(“C://temp//sample3.pdf”);
wi3.close();
wC3 = null;

//----- draw Line Pattern 4(In:FileInputStream, Out:FileOutputStream)
PdfContentEditor wC4 = new PdfContentEditor();
FileInputStream wi4 = new FileInputStream(“C://temp//sample.pdf”);
FileOutputStream wo4 = new FileOutputStream(“C://temp//sample4.pdf”);
wC4.bindPdf(wi4);
wC4.createLine(rect, “”, 100, 100, 400, 100, 1, 5, “s”, dashArray, LEArray, c);
wC4.save(wo4);
wi4.close();
wo4.close();
wC4 = null;
} catch (Exception ex) {
}

this is error message.
java.lang.Throwable: Warning: You did not close the PDF Document
at com.aspose.pdf.kit.hq.finalize(Unknown Source)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
java.lang.Throwable: Warning: You did not close the PDF Document
at com.aspose.pdf.kit.hq.finalize(Unknown Source)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)

Hi,

Thank you for considering Aspose.

I have reproduce the error. I will discuss this with the developers and we will let you know as soon as solution is found.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Hi,

We have fixed this problem. I have send new jar to your e-mail, please check and try it.

Best regards.

Hi, GeorgieYuan,

I tested the file which you send me.
The problem that occurred was revised.
Tank you.

but more question…
Why is it that a
AsposePdfKitXXXXtmp is made?
What is this file?
In addition, is not this file deleted automatically?

Hi, Aspose Support Staffs.

I use Modified PdfContentEditor Class.
However, the following warning is displayed.
Why is it?

java.lang.Throwable: Warning: You did not close the PDF Document
at com.aspose.pdf.kit.hq.finalize(Unknown Source)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)

Hi,

I have found the error. We will try to fix it soon. Sorry for inconvenience.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html