Free Support Forum - aspose.com

SVG not converted to PDF using Aspose.SVG(Java)

Hello, im trying to render svg image onto PDF with examples provided in Aspose git repository. However I’m getting following error:

Exception in thread “main” class com.aspose.pdf.internal.ms.System.lh: Error loading file: Unsupported file format
Parameter name: input
com.aspose.pdf.internal.l69v.lf.lI(Unknown Source)
com.aspose.pdf.internal.l69v.lf.(Unknown Source)
com.aspose.pdf.internal.l69v.lf.(Unknown Source)
com.aspose.pdf.internal.l69v.l1v.lI(Unknown Source)
com.aspose.pdf.ImageStamp.(Unknown Source)
com.aspose.pdf.examples.AsposePdfExamples.StampsAndWatermarks.AddingImageStampInPDFFile.main(AddingImageStampInPDFFile.java:13)
at com.aspose.pdf.internal.l69v.lf.lI(Unknown Source)
at com.aspose.pdf.internal.l69v.lf.(Unknown Source)
at com.aspose.pdf.internal.l69v.lf.(Unknown Source)
at com.aspose.pdf.internal.l69v.l1v.lI(Unknown Source)
at com.aspose.pdf.ImageStamp.(Unknown Source)
at com.aspose.pdf.examples.AsposePdfExamples.StampsAndWatermarks.AddingImageStampInPDFFile.main(AddingImageStampInPDFFile.java:13)

Rendering jpg image works fine.

@AndrewPazdalski,

Can you please confirm if you are trying to convert SVG image to PDF. If you are doing this than please use following sample code on your end or share your issue in more details along with sample code and source files so that we may further investigate to help you out.

SvgLoadOptions loadopt = new SvgLoadOptions();
Document Doc = new Document(dataDir + "EquationSvg.svg", loadopt);
Doc.save(dataDir + "SvgToPDF.pdf");

Hello, I’m playing with examples from aspose repository: https://github.com/aspose-pdf/Aspose.PDF-for-Java. Precisely /java/com.aspose.pdf.examples/StampsAndWatermarks/AddingImageStampInPDFFile.java

Here is the code:

package com.aspose.pdf.examples.AsposePdfExamples.StampsAndWatermarks;

import com.aspose.pdf.Document;
import com.aspose.pdf.ImageStamp;
import com.aspose.pdf.Rotation;

public class AddingImageStampInPDFFile {

public static void main(String[] args) {
	// open document
	Document pdfDocument = new Document("input.pdf");
	// create image stamp
	ImageStamp imageStamp = new ImageStamp("signature.svg");
	imageStamp.setBackground(true);
	imageStamp.setXIndent(100);
	imageStamp.setYIndent(100);
	imageStamp.setHeight(300);
	imageStamp.setWidth(300);
	imageStamp.setRotate(Rotation.on270);
	imageStamp.setOpacity(0.5);
	// add stamp to particular page
	pdfDocument.getPages().get_Item(1).addStamp(imageStamp);
	// save output document
	pdfDocument.save("PageNumberStamp_output.pdf");
}

}

If i replace signature.svg, with some jpg image it correctly renders into pdf document, but trying it with svg results in mentioned error.

@AndrewPazdalski,

Can you please share source pdf file with us so that we may further investigate to help you out.

Concat1.pdf (124.8 KB)

This is the file I’m trying to render my svg image into. I would gladly upload it too, but it says that this file type is not authroized for uploading here.

Also, my system is macos catalina version 10.15.2. Im using Java 1.8 sdk.

@AndrewPazdalski,

We have tested the scenario in our environment and were able to notice the issue. We have logged it as PDFJAVA-39090 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

Thank you, could you suggest any alternative way to insert svg to my pdf document ? Or is stamp only way to do that with Aspose ? Also, where can i track if my bug was fixed ?

Hi, Can we get a date when you will complete this fix? I need it for Product planning after we just purchased your product for over $12k for this purpose. Please advise.