Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies within .NET ( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Tue Nov 30, 2021 12:52 am

Hello,

I am trying to use this library (Free Spire.pdf for Java v4.4.1) to convert PDFs to SVG. I am able to successfully load the file through pdf.loadFromBytes, however when I then try saveToStream with a new byte array output stream, that new output stream remains empty.

Code: Select all
private byte[] convertPdfToSvg(byte[] pdfBytes) { //this byte array comes from a MultipartFile (multipartFile.getBytes())
        PdfDocument pdf = new PdfDocument();
        pdf.loadFromBytes(pdfBytes);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        pdf.saveToStream(out, FileFormat.SVG); //out does not change

        byte[] retBytes = out.toByteArray();
        pdf.close();
        return retBytes;
    }


Any assistance is appreciated, thank you.

Owkrtolm
 
Posts: 1
Joined: Tue Nov 30, 2021 12:33 am

Tue Nov 30, 2021 3:54 am

Hello,

Thanks for your inquiry!

I have reproduced your issue and logged it in our issue tracking system with the ticket SPIREPDF-4817 for further investigation.

We will let you know if there is any update. Sorry for the inconvenience caused.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Jan 19, 2022 8:54 am

Hello,

Thanks for your patience!

Glad to inform that we just released Spire.PDF for Java Version:5.1.0 which fixes the issue of SPIREPDF-4817.

Please download the fix version from the following link and refer to the following code to test.

Website Link: https://www.e-iceblue.com/Download/pdf-for-java.html
Code: Select all
ByteArrayOutputStream[] outputStreams = pdf.saveToStream(FileFormat.SVG);
ByteArrayOutputStream[] outputStreams = pdf.saveToStream(startIndex, endIndex, FileFormat.SVG);


Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Jan 24, 2022 8:46 am

Hello,

Hope you are doing well!

Has the issue been solved now? Could you please give us some feedback at your convenience?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF