You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by 槻木正臣 <ma...@apptec.co.jp> on 2020/07/30 05:28:12 UTC

About SVG conversion in Apache pdfbox

To Whom It May Concern

I am using apache batik 1.9 and apache pdfbox 2.0.20 to convert PDF to SVG.

When I set 150 in PDFPageable, unnecessary lines are displayed.
Is there a way around it?

PDF file
[image: pdf.png]

SVG file
[image: svg.png]

Source code
-----
PDDocument pddocument = null;
Writer out = null;
try {
    pddocument = PDDocument.load(new File(loadfile));
    PDFPageable document = new PDFPageable(pddocument, Orientation.AUTO,
false, 150);

    DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
    String svgNS = "http://www.w3.org/2000/svg";
    org.w3c.dom.Document svgDocument = domImpl.createDocument(svgNS, "svg",
null);
    SVGGeneratorContext ctx =
SVGGeneratorContext.createDefault(svgDocument);
    ctx.setEmbeddedFontsOn(true);

    SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
    Printable printTbl = document.getPrintable(page);
    printTbl.print(svgGenerator, document.getPageFormat(page), page);

    out = new OutputStreamWriter(new FileOutputStream(new File(savefile)),
"UTF-8");
    svgGenerator.stream(out);
    svgGenerator.dispose();

} finally {
    if (out != null){
        out.close();
    }
    if(pddocument != null){
        pddocument.close();
    }
}
-----

I look forward to hearing from you.
━━━━━━━━━━━━━━━━━━━━━━━
応用技術株式会社
槻木 正臣(Tsukigi Masaomi)
〒530-0015
大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
Tel:(06)6373-6101 Fax:(06)6373-6100
E-mail : ma-tsukigi@apptec.co.jp
━━━━━━━━━━━━━━━━━━━━━━━

-- 
【秘密保持のお願い】このメールには機密情報や個人情報が含まれている可能性がございます。誤ってこのメールを受信された場合は、お手数ですがシステム上から削除いただき、送信者または管理者(privacy@apptec.co.jp 
<ma...@apptec.co.jp>)に御連絡頂ますようお願い申し上げます。
Confidentiality Note: 
This email may contain confidential and/or private information. If you 
received this email in error please  delete and notify to sender or 
adminstrator(privacy@apptec.co.jp <ma...@apptec.co.jp>).


Re: About SVG conversion in Apache pdfbox

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

Attachments don't come through. Please upload them to a sharehoster.

Tilman

Am 30.07.2020 um 07:28 schrieb 槻木正臣:
> To Whom It May Concern
>
> I am using apache batik 1.9 and apache pdfbox 2.0.20 to convert PDF to 
> SVG.
>
> When I set 150 in PDFPageable, unnecessary lines are displayed.
> Is there a way around it?
>
> PDF file
> pdf.png
>
> SVG file
> svg.png
>
> Source code
> -----
> PDDocument pddocument = null;
> Writer out = null;
> try {
>     pddocument = PDDocument.load(new File(loadfile));
>     PDFPageable document = new PDFPageable(pddocument, 
> Orientation.AUTO, false, 150);
>
>     DOMImplementation domImpl = 
> GenericDOMImplementation.getDOMImplementation();
>     String svgNS = "http://www.w3.org/2000/svg";
>     org.w3c.dom.Document svgDocument = domImpl.createDocument(svgNS, 
> "svg", null);
>     SVGGeneratorContext ctx = 
> SVGGeneratorContext.createDefault(svgDocument);
>     ctx.setEmbeddedFontsOn(true);
>
>     SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
>     Printable printTbl = document.getPrintable(page);
>     printTbl.print(svgGenerator, document.getPageFormat(page), page);
>
>     out = new OutputStreamWriter(new FileOutputStream(new 
> File(savefile)), "UTF-8");
>     svgGenerator.stream(out);
>     svgGenerator.dispose();
>
> } finally {
>     if (out != null){
>         out.close();
>     }
>     if(pddocument != null){
>         pddocument.close();
>     }
> }
> -----
>
> I look forward to hearing from you.
> ━━━━━━━━━━━━━━━━━━━━━━━
>   応用技術株式会社
>   槻木 正臣(Tsukigi Masaomi)
>   〒530-0015
>    大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
>   Tel:(06)6373-6101 Fax:(06)6373-6100
>   E-mail : ma-tsukigi@apptec.co.jp <ma...@apptec.co.jp>
> ━━━━━━━━━━━━━━━━━━━━━━━
>
> 【秘密保持のお願い】このメールには機密情報や個人情報が含まれている可能性がございます。誤ってこのメールを受信された場合は、お手数ですがシステム上から削除いただき、送信者または管理者(privacy@apptec.co.jp 
> <ma...@apptec.co.jp>)に御連絡頂ますようお願い申し上げます。
>
> Confidentiality Note: This email may contain confidential 
> and/or private information. If you received this email in error 
> please  delete and notify to sender or 
> adminstrator(privacy@apptec.co.jp <ma...@apptec.co.jp>).



Re: About SVG conversion in Apache pdfbox

Posted by Tilman Hausherr <TH...@t-online.de>.
Hello,

The source PDF file is missing. And the variable "page" is not declared 
(is it 0 ?). Please try with Batik 1.13, that is the current version. 
dpi 150 means that the page is "printed" as an image. If you're using 
SVG, it would make more sense to use 0 so that vector graphics are used. 
And PDFBox is now at 2.0.21.

Tilman

Am 07.09.2020 um 02:42 schrieb 槻木正臣:
> To Whom It May Concern
>
> I uploaded the file, so please check
> https://1drv.ms/u/s!ApGmuqgZtcofg2JhrnG195vQSpFc?e=qtmDXV
>
> I look forward to hearing from you.
> ━━━━━━━━━━━━━━━━━━━━━━━
> 応用技術株式会社
> 槻木 正臣(Tsukigi Masaomi)
> 〒530-0015
> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
> Tel:(06)6373-6101 Fax:(06)6373-6100
> E-mail : ma-tsukigi@apptec.co.jp
> ━━━━━━━━━━━━━━━━━━━━━━━
>> Hi,
>>
>> Attachments don't come through. Please upload them to a sharehoster.
>>
>> Tilman
>>
>> Am 30.07.2020 um 07:28 schrieb 槻木正臣:
>>> To Whom It May Concern
>>>
>>> I am using apache batik 1.9 and apache pdfbox 2.0.20 to convert PDF to
>>> SVG.
>>>
>>> When I set 150 in PDFPageable, unnecessary lines are displayed.
>>> Is there a way around it?
>>>
>>> PDF file
>>> pdf.png
>>>
>>> SVG file
>>> svg.png
>>>
>>> Source code
>>> -----
>>> PDDocument pddocument = null;
>>> Writer out = null;
>>> try {
>>>      pddocument = PDDocument.load(new File(loadfile));
>>>      PDFPageable document = new PDFPageable(pddocument,
>>> Orientation.AUTO, false, 150);
>>>
>>>      DOMImplementation domImpl =
>>> GenericDOMImplementation.getDOMImplementation();
>>>      String svgNS = "http://www.w3.org/2000/svg";
>>>      org.w3c.dom.Document svgDocument = domImpl.createDocument(svgNS,
>>> "svg", null);
>>>      SVGGeneratorContext ctx =
>>> SVGGeneratorContext.createDefault(svgDocument);
>>>      ctx.setEmbeddedFontsOn(true);
>>>
>>>      SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
>>>      Printable printTbl = document.getPrintable(page);
>>>      printTbl.print(svgGenerator, document.getPageFormat(page), page);
>>>
>>>      out = new OutputStreamWriter(new FileOutputStream(new
>>> File(savefile)), "UTF-8");
>>>      svgGenerator.stream(out);
>>>      svgGenerator.dispose();
>>>
>>> } finally {
>>>      if (out != null){
>>>          out.close();
>>>      }
>>>      if(pddocument != null){
>>>          pddocument.close();
>>>      }
>>> }
>>> -----
>>>
>>> I look forward to hearing from you.
>>> ━━━━━━━━━━━━━━━━━━━━━━━
>>> 応用技術株式会社
>>> 槻木 正臣(Tsukigi Masaomi)
>>> 〒530-0015
>>> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
>>> Tel:(06)6373-6101 Fax:(06)6373-6100
>>> E-mail : ma-tsukigi@apptec.co.jp <ma...@apptec.co.jp>
>>> ━━━━━━━━━━━━━━━━━━━━━━━



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: About SVG conversion in Apache pdfbox

Posted by 槻木正臣 <ma...@apptec.co.jp>.
To Whom It May Concern

Thank you for checking.
Setting IMAGE_DPI to 0 will increase the size of the SVG file.
I would like to convert at 150 DPI.

Will this issue be resolved in the near future?

I look forward to hearing from you.
━━━━━━━━━━━━━━━━━━━━━━━
応用技術株式会社
槻木 正臣(Tsukigi Masaomi)
〒530-0015
大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
Tel:(06)6373-6101 Fax:(06)6373-6100
E-mail : ma-tsukigi@apptec.co.jp
━━━━━━━━━━━━━━━━━━━━━━━

I had to do some refactoring because your code expects a directory.
Anyway, after that, here's what I got:

Exception in thread "main" java.lang.NullPointerException
     at
org.apache.batik.svggen.ImageHandlerBase64Encoder.encodeImage(ImageHandlerBase64Encoder.java:157)
     at
org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(ImageHandlerBase64Encoder.java:133)
     at
org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(ImageHandlerBase64Encoder.java:72)
     at
org.apache.batik.svggen.DefaultImageHandler.handleImage(DefaultImageHandler.java:63)
     at
org.apache.batik.svggen.SimpleImageHandler.handleImage(SimpleImageHandler.java:100)
     at
org.apache.batik.svggen.SVGGraphics2D.drawImage(SVGGraphics2D.java:676)
     at org.apache.pdfbox.printing.PDFPrintable.print(PDFPrintable.java:264)
     at com.mycompany.svgtest.Pdf2Svg.convertPdfToSvgFile(Pdf2Svg.java:140)
     at com.mycompany.svgtest.Pdf2Svg.doFile(Pdf2Svg.java:69)
     at com.mycompany.svgtest.Pdf2Svg.main(Pdf2Svg.java:34)

After I changed the IMAGE_DPI parameter to 0 I got an SVG file. But your
PDF isn't related to the two images you posted, it is a different one.

pom.xml segment:

         <dependency>
             <groupId>org.apache.xmlgraphics</groupId>
             <artifactId>fop</artifactId>
             <version>2.5</version>
         </dependency>
         <dependency>
             <groupId>org.apache.pdfbox</groupId>
             <artifactId>pdfbox-app</artifactId>
             <version>2.0.21</version>
         </dependency>

after reading
https://stackoverflow.com/questions/16138850/
I added

<dependency>
             <groupId>org.apache.xmlgraphics</groupId>
             <artifactId>batik-codec</artifactId>
             <version>1.13</version>
         </dependency>

now it worked with 150. Yes it has an ugly line. I tried increasing the
dpi. With 600 dpi, the line vanished. Of course, the best is to use 0,
then you get vector graphics with is the point when you're using SVG.

I tried an ordinary print to a PDF with 150 dpi and did not get the
effect. Thus I suspect it is not related to PDF. It's probably a problem
by converting images to SVG.

But all this is moot if you use "0" as dpi.

Tilman


Am 17.09.2020 um 07:56 schrieb 槻木正臣:
> To Whom It May Concern
>
> I uploaded the file, so please check
> https://1drv.ms/u/s!ApGmuqgZtcofg2JhrnG195vQSpFc?e=qtmDXV
>
> ・Pdf2Svg.java
> source file
>
> ・Sample01.pdf
> PDF file
>
> ・Sample01_1.svg
> Converted SVG file
>
> I look forward to hearing from you.
> ━━━━━━━━━━━━━━━━━━━━━━━
> 応用技術株式会社
> 槻木 正臣(Tsukigi Masaomi)
> 〒530-0015
> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
> Tel:(06)6373-6101 Fax:(06)6373-6100
> E-mail : ma-tsukigi@apptec.co.jp
> ━━━━━━━━━━━━━━━━━━━━━━━
>
> Hello,
>
> The source PDF file is missing. And the variable "page" is not declared
> (is it 0 ?). Please try with Batik 1.13, that is the current version.
> dpi 150 means that the page is "printed" as an image. If you're using
> SVG, it would make more sense to use 0 so that vector graphics are used.
> And PDFBox is now at 2.0.21.
>
> Tilman
>
> Am 07.09.2020 um 02:42 schrieb 槻木正臣:
>> To Whom It May Concern
>>
>> I uploaded the file, so please check
>> https://1drv.ms/u/s!ApGmuqgZtcofg2JhrnG195vQSpFc?e=qtmDXV
>>
>> I look forward to hearing from you.
>> ━━━━━━━━━━━━━━━━━━━━━━━
>> 応用技術株式会社
>> 槻木 正臣(Tsukigi Masaomi)
>> 〒530-0015
>> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
>> Tel:(06)6373-6101 Fax:(06)6373-6100
>> E-mail : ma-tsukigi@apptec.co.jp
>> ━━━━━━━━━━━━━━━━━━━━━━━
>>> Hi,
>>>
>>> Attachments don't come through. Please upload them to a sharehoster.
>>>
>>> Tilman
>>>
>>> Am 30.07.2020 um 07:28 schrieb 槻木正臣:
>>>> To Whom It May Concern
>>>>
>>>> I am using apache batik 1.9 and apache pdfbox 2.0.20 to convert PDF to
>>>> SVG.
>>>>
>>>> When I set 150 in PDFPageable, unnecessary lines are displayed.
>>>> Is there a way around it?
>>>>
>>>> PDF file
>>>> pdf.png
>>>>
>>>> SVG file
>>>> svg.png
>>>>
>>>> Source code
>>>> -----
>>>> PDDocument pddocument = null;
>>>> Writer out = null;
>>>> try {
>>>>       pddocument = PDDocument.load(new File(loadfile));
>>>>       PDFPageable document = new PDFPageable(pddocument,
>>>> Orientation.AUTO, false, 150);
>>>>
>>>>       DOMImplementation domImpl =
>>>> GenericDOMImplementation.getDOMImplementation();
>>>>       String svgNS = "http://www.w3.org/2000/svg";
>>>>       org.w3c.dom.Document svgDocument = domImpl.createDocument(svgNS,
>>>> "svg", null);
>>>>       SVGGeneratorContext ctx =
>>>> SVGGeneratorContext.createDefault(svgDocument);
>>>>       ctx.setEmbeddedFontsOn(true);
>>>>
>>>>       SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
>>>>       Printable printTbl = document.getPrintable(page);
>>>>       printTbl.print(svgGenerator, document.getPageFormat(page), page);
>>>>
>>>>       out = new OutputStreamWriter(new FileOutputStream(new
>>>> File(savefile)), "UTF-8");
>>>>       svgGenerator.stream(out);
>>>>       svgGenerator.dispose();
>>>>
>>>> } finally {
>>>>       if (out != null){
>>>>           out.close();
>>>>       }
>>>>       if(pddocument != null){
>>>>           pddocument.close();
>>>>       }
>>>> }
>>>> -----
>>>>
>>>> I look forward to hearing from you.
>>>> ━━━━━━━━━━━━━━━━━━━━━━━
>>>> 応用技術株式会社
>>>> 槻木 正臣(Tsukigi Masaomi)
>>>> 〒530-0015
>>>> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
>>>> Tel:(06)6373-6101 Fax:(06)6373-6100
>>>> E-mail : ma-tsukigi@apptec.co.jp <ma...@apptec.co.jp>
>>>> ━━━━━━━━━━━━━━━━━━━━━━━
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

>

-- 
【秘密保持のお願い】このメールには機密情報や個人情報が含まれている可能性がございます。誤ってこのメールを受信された場合は、お手数ですがシステム上から削除いただき、送信者または管理者(privacy@apptec.co.jp 
<ma...@apptec.co.jp>)に御連絡頂ますようお願い申し上げます。
Confidentiality Note: 
This email may contain confidential and/or private information. If you 
received this email in error please  delete and notify to sender or 
adminstrator(privacy@apptec.co.jp <ma...@apptec.co.jp>).


Re: About SVG conversion in Apache pdfbox

Posted by Tilman Hausherr <TH...@t-online.de>.
> To Whom It May Concern
>
> Thank you for checking.
> Setting IMAGE_DPI to 0 will increase the size of the SVG file.
> I would like to convert at 150 DPI.
>
> Will this issue be resolved in the near future?
>
> I look forward to hearing from you.

No, because it isn't a PDFBox issue. It is a Batik issue. You should try to reproduce the issue by "printing" an image only (without PDFBox) and create an issue there.

Rendering images in SVG is a poor decision. The "V" in SVG is for vectors. Vectors mean that it will look great in every resolution.

Tilman


Re: About SVG conversion in Apache pdfbox

Posted by Tilman Hausherr <TH...@t-online.de>.
I had to do some refactoring because your code expects a directory. 
Anyway, after that, here's what I got:

Exception in thread "main" java.lang.NullPointerException
     at 
org.apache.batik.svggen.ImageHandlerBase64Encoder.encodeImage(ImageHandlerBase64Encoder.java:157)
     at 
org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(ImageHandlerBase64Encoder.java:133)
     at 
org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(ImageHandlerBase64Encoder.java:72)
     at 
org.apache.batik.svggen.DefaultImageHandler.handleImage(DefaultImageHandler.java:63)
     at 
org.apache.batik.svggen.SimpleImageHandler.handleImage(SimpleImageHandler.java:100)
     at 
org.apache.batik.svggen.SVGGraphics2D.drawImage(SVGGraphics2D.java:676)
     at org.apache.pdfbox.printing.PDFPrintable.print(PDFPrintable.java:264)
     at com.mycompany.svgtest.Pdf2Svg.convertPdfToSvgFile(Pdf2Svg.java:140)
     at com.mycompany.svgtest.Pdf2Svg.doFile(Pdf2Svg.java:69)
     at com.mycompany.svgtest.Pdf2Svg.main(Pdf2Svg.java:34)

After I changed the IMAGE_DPI parameter to 0 I got an SVG file. But your 
PDF isn't related to the two images you posted, it is a different one.

pom.xml segment:

         <dependency>
             <groupId>org.apache.xmlgraphics</groupId>
             <artifactId>fop</artifactId>
             <version>2.5</version>
         </dependency>
         <dependency>
             <groupId>org.apache.pdfbox</groupId>
             <artifactId>pdfbox-app</artifactId>
             <version>2.0.21</version>
         </dependency>

after reading
https://stackoverflow.com/questions/16138850/
I added

<dependency>
             <groupId>org.apache.xmlgraphics</groupId>
             <artifactId>batik-codec</artifactId>
             <version>1.13</version>
         </dependency>

now it worked with 150. Yes it has an ugly line. I tried increasing the 
dpi. With 600 dpi, the line vanished. Of course, the best is to use 0, 
then you get vector graphics with is the point when you're using SVG.

I tried an ordinary print to a PDF with 150 dpi and did not get the 
effect. Thus I suspect it is not related to PDF. It's probably a problem 
by converting images to SVG.

But all this is moot if you use "0" as dpi.

Tilman


Am 17.09.2020 um 07:56 schrieb 槻木正臣:
> To Whom It May Concern
>
> I uploaded the file, so please check
> https://1drv.ms/u/s!ApGmuqgZtcofg2JhrnG195vQSpFc?e=qtmDXV
>
> ・Pdf2Svg.java
> source file
>
> ・Sample01.pdf
> PDF file
>
> ・Sample01_1.svg
> Converted SVG file
>
> I look forward to hearing from you.
> ━━━━━━━━━━━━━━━━━━━━━━━
> 応用技術株式会社
> 槻木 正臣(Tsukigi Masaomi)
> 〒530-0015
> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
> Tel:(06)6373-6101 Fax:(06)6373-6100
> E-mail : ma-tsukigi@apptec.co.jp
> ━━━━━━━━━━━━━━━━━━━━━━━
>
> Hello,
>
> The source PDF file is missing. And the variable "page" is not declared
> (is it 0 ?). Please try with Batik 1.13, that is the current version.
> dpi 150 means that the page is "printed" as an image. If you're using
> SVG, it would make more sense to use 0 so that vector graphics are used.
> And PDFBox is now at 2.0.21.
>
> Tilman
>
> Am 07.09.2020 um 02:42 schrieb 槻木正臣:
>> To Whom It May Concern
>>
>> I uploaded the file, so please check
>> https://1drv.ms/u/s!ApGmuqgZtcofg2JhrnG195vQSpFc?e=qtmDXV
>>
>> I look forward to hearing from you.
>> ━━━━━━━━━━━━━━━━━━━━━━━
>> 応用技術株式会社
>> 槻木 正臣(Tsukigi Masaomi)
>> 〒530-0015
>> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
>> Tel:(06)6373-6101 Fax:(06)6373-6100
>> E-mail : ma-tsukigi@apptec.co.jp
>> ━━━━━━━━━━━━━━━━━━━━━━━
>>> Hi,
>>>
>>> Attachments don't come through. Please upload them to a sharehoster.
>>>
>>> Tilman
>>>
>>> Am 30.07.2020 um 07:28 schrieb 槻木正臣:
>>>> To Whom It May Concern
>>>>
>>>> I am using apache batik 1.9 and apache pdfbox 2.0.20 to convert PDF to
>>>> SVG.
>>>>
>>>> When I set 150 in PDFPageable, unnecessary lines are displayed.
>>>> Is there a way around it?
>>>>
>>>> PDF file
>>>> pdf.png
>>>>
>>>> SVG file
>>>> svg.png
>>>>
>>>> Source code
>>>> -----
>>>> PDDocument pddocument = null;
>>>> Writer out = null;
>>>> try {
>>>>       pddocument = PDDocument.load(new File(loadfile));
>>>>       PDFPageable document = new PDFPageable(pddocument,
>>>> Orientation.AUTO, false, 150);
>>>>
>>>>       DOMImplementation domImpl =
>>>> GenericDOMImplementation.getDOMImplementation();
>>>>       String svgNS = "http://www.w3.org/2000/svg";
>>>>       org.w3c.dom.Document svgDocument = domImpl.createDocument(svgNS,
>>>> "svg", null);
>>>>       SVGGeneratorContext ctx =
>>>> SVGGeneratorContext.createDefault(svgDocument);
>>>>       ctx.setEmbeddedFontsOn(true);
>>>>
>>>>       SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
>>>>       Printable printTbl = document.getPrintable(page);
>>>>       printTbl.print(svgGenerator, document.getPageFormat(page), page);
>>>>
>>>>       out = new OutputStreamWriter(new FileOutputStream(new
>>>> File(savefile)), "UTF-8");
>>>>       svgGenerator.stream(out);
>>>>       svgGenerator.dispose();
>>>>
>>>> } finally {
>>>>       if (out != null){
>>>>           out.close();
>>>>       }
>>>>       if(pddocument != null){
>>>>           pddocument.close();
>>>>       }
>>>> }
>>>> -----
>>>>
>>>> I look forward to hearing from you.
>>>> ━━━━━━━━━━━━━━━━━━━━━━━
>>>> 応用技術株式会社
>>>> 槻木 正臣(Tsukigi Masaomi)
>>>> 〒530-0015
>>>> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
>>>> Tel:(06)6373-6101 Fax:(06)6373-6100
>>>> E-mail : ma-tsukigi@apptec.co.jp <ma...@apptec.co.jp>
>>>> ━━━━━━━━━━━━━━━━━━━━━━━
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: About SVG conversion in Apache pdfbox

Posted by 槻木正臣 <ma...@apptec.co.jp>.
To Whom It May Concern

I uploaded the file, so please check
https://1drv.ms/u/s!ApGmuqgZtcofg2JhrnG195vQSpFc?e=qtmDXV

・Pdf2Svg.java
source file

・Sample01.pdf
PDF file

・Sample01_1.svg
Converted SVG file

I look forward to hearing from you.
━━━━━━━━━━━━━━━━━━━━━━━
応用技術株式会社
槻木 正臣(Tsukigi Masaomi)
〒530-0015
大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
Tel:(06)6373-6101 Fax:(06)6373-6100
E-mail : ma-tsukigi@apptec.co.jp
━━━━━━━━━━━━━━━━━━━━━━━

Hello,

The source PDF file is missing. And the variable "page" is not declared
(is it 0 ?). Please try with Batik 1.13, that is the current version.
dpi 150 means that the page is "printed" as an image. If you're using
SVG, it would make more sense to use 0 so that vector graphics are used.
And PDFBox is now at 2.0.21.

Tilman

Am 07.09.2020 um 02:42 schrieb 槻木正臣:
> To Whom It May Concern
>
> I uploaded the file, so please check
> https://1drv.ms/u/s!ApGmuqgZtcofg2JhrnG195vQSpFc?e=qtmDXV
>
> I look forward to hearing from you.
> ━━━━━━━━━━━━━━━━━━━━━━━
> 応用技術株式会社
> 槻木 正臣(Tsukigi Masaomi)
> 〒530-0015
> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
> Tel:(06)6373-6101 Fax:(06)6373-6100
> E-mail : ma-tsukigi@apptec.co.jp
> ━━━━━━━━━━━━━━━━━━━━━━━
>> Hi,
>>
>> Attachments don't come through. Please upload them to a sharehoster.
>>
>> Tilman
>>
>> Am 30.07.2020 um 07:28 schrieb 槻木正臣:
>>> To Whom It May Concern
>>>
>>> I am using apache batik 1.9 and apache pdfbox 2.0.20 to convert PDF to
>>> SVG.
>>>
>>> When I set 150 in PDFPageable, unnecessary lines are displayed.
>>> Is there a way around it?
>>>
>>> PDF file
>>> pdf.png
>>>
>>> SVG file
>>> svg.png
>>>
>>> Source code
>>> -----
>>> PDDocument pddocument = null;
>>> Writer out = null;
>>> try {
>>>      pddocument = PDDocument.load(new File(loadfile));
>>>      PDFPageable document = new PDFPageable(pddocument,
>>> Orientation.AUTO, false, 150);
>>>
>>>      DOMImplementation domImpl =
>>> GenericDOMImplementation.getDOMImplementation();
>>>      String svgNS = "http://www.w3.org/2000/svg";
>>>      org.w3c.dom.Document svgDocument = domImpl.createDocument(svgNS,
>>> "svg", null);
>>>      SVGGeneratorContext ctx =
>>> SVGGeneratorContext.createDefault(svgDocument);
>>>      ctx.setEmbeddedFontsOn(true);
>>>
>>>      SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
>>>      Printable printTbl = document.getPrintable(page);
>>>      printTbl.print(svgGenerator, document.getPageFormat(page), page);
>>>
>>>      out = new OutputStreamWriter(new FileOutputStream(new
>>> File(savefile)), "UTF-8");
>>>      svgGenerator.stream(out);
>>>      svgGenerator.dispose();
>>>
>>> } finally {
>>>      if (out != null){
>>>          out.close();
>>>      }
>>>      if(pddocument != null){
>>>          pddocument.close();
>>>      }
>>> }
>>> -----
>>>
>>> I look forward to hearing from you.
>>> ━━━━━━━━━━━━━━━━━━━━━━━
>>> 応用技術株式会社
>>> 槻木 正臣(Tsukigi Masaomi)
>>> 〒530-0015
>>> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
>>> Tel:(06)6373-6101 Fax:(06)6373-6100
>>> E-mail : ma-tsukigi@apptec.co.jp <ma...@apptec.co.jp>
>>> ━━━━━━━━━━━━━━━━━━━━━━━



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

>

-- 
【秘密保持のお願い】このメールには機密情報や個人情報が含まれている可能性がございます。誤ってこのメールを受信された場合は、お手数ですがシステム上から削除いただき、送信者または管理者(privacy@apptec.co.jp 
<ma...@apptec.co.jp>)に御連絡頂ますようお願い申し上げます。
Confidentiality Note: 
This email may contain confidential and/or private information. If you 
received this email in error please  delete and notify to sender or 
adminstrator(privacy@apptec.co.jp <ma...@apptec.co.jp>).


Re: About SVG conversion in Apache pdfbox

Posted by 槻木正臣 <ma...@apptec.co.jp>.
To Whom It May Concern

I uploaded the file, so please check
https://1drv.ms/u/s!ApGmuqgZtcofg2JhrnG195vQSpFc?e=qtmDXV

I look forward to hearing from you.
━━━━━━━━━━━━━━━━━━━━━━━
応用技術株式会社
槻木 正臣(Tsukigi Masaomi)
〒530-0015
大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
Tel:(06)6373-6101 Fax:(06)6373-6100
E-mail : ma-tsukigi@apptec.co.jp
━━━━━━━━━━━━━━━━━━━━━━━
>Hi,
>
>Attachments don't come through. Please upload them to a sharehoster.
>
>Tilman
>
>Am 30.07.2020 um 07:28 schrieb 槻木正臣:
>> To Whom It May Concern
>>
>> I am using apache batik 1.9 and apache pdfbox 2.0.20 to convert PDF to
>> SVG.
>>
>> When I set 150 in PDFPageable, unnecessary lines are displayed.
>> Is there a way around it?
>>
>> PDF file
>> pdf.png
>>
>> SVG file
>> svg.png
>>
>> Source code
>> -----
>> PDDocument pddocument = null;
>> Writer out = null;
>> try {
>>     pddocument = PDDocument.load(new File(loadfile));
>>     PDFPageable document = new PDFPageable(pddocument,
>> Orientation.AUTO, false, 150);
>>
>>     DOMImplementation domImpl =
>> GenericDOMImplementation.getDOMImplementation();
>>     String svgNS = "http://www.w3.org/2000/svg";
>>     org.w3c.dom.Document svgDocument = domImpl.createDocument(svgNS,
>> "svg", null);
>>     SVGGeneratorContext ctx =
>> SVGGeneratorContext.createDefault(svgDocument);
>>     ctx.setEmbeddedFontsOn(true);
>>
>>     SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
>>     Printable printTbl = document.getPrintable(page);
>>     printTbl.print(svgGenerator, document.getPageFormat(page), page);
>>
>>     out = new OutputStreamWriter(new FileOutputStream(new
>> File(savefile)), "UTF-8");
>>     svgGenerator.stream(out);
>>     svgGenerator.dispose();
>>
>> } finally {
>>     if (out != null){
>>         out.close();
>>     }
>>     if(pddocument != null){
>>         pddocument.close();
>>     }
>> }
>> -----
>>
>> I look forward to hearing from you.
>> ━━━━━━━━━━━━━━━━━━━━━━━
>> 応用技術株式会社
>> 槻木 正臣(Tsukigi Masaomi)
>> 〒530-0015
>> 大阪市北区中崎西2丁目4番12号 梅田センタービル 10階
>> Tel:(06)6373-6101 Fax:(06)6373-6100
>> E-mail : ma-tsukigi@apptec.co.jp <ma...@apptec.co.jp>
>> ━━━━━━━━━━━━━━━━━━━━━━━

-- 
【秘密保持のお願い】このメールには機密情報や個人情報が含まれている可能性がございます。誤ってこのメールを受信された場合は、お手数ですがシステム上から削除いただき、送信者または管理者(privacy@apptec.co.jp 
<ma...@apptec.co.jp>)に御連絡頂ますようお願い申し上げます。
Confidentiality Note: 
This email may contain confidential and/or private information. If you 
received this email in error please  delete and notify to sender or 
adminstrator(privacy@apptec.co.jp <ma...@apptec.co.jp>).