Insert EMF image inside PDF using Java with Aspose.PDF

EMF image cannot be inserted into PDF with latest Java Aspose.Pdf release.
Is there any plan (a date) to support EMF?
We’re evaluating PDF library.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.Pdf for Java.

Well, I am afraid; currently Aspose.Pdf for Java does not support adding EMF images to PDF. The new feature request has been already included in our issue tracking system with issue id: PDFJAVA-31650. However, this issue may not be included in the release in near future due to the complexity of the issue. We will update you via this forum thread once there is any update regarding this issue.

Sorry for the inconvenience,

Any update on emf and pdf?

Hi there,


Thanks for your inquiry. We have a good news for you, the requested feature will be available in upcoming release of Aspose.Pdf for Java. Currently we are working on testing the new release version of Aspose.Pdf for Java, autoported version of Aspose.Pdf for .Net (the code base is ported from Aspose.Pdf for .NET to Java platform), which will provide this feature. We hope to release the new version of Aspose.Pdf for Java within couple of weeks.

We are sorry for this inconvenience.

Best Regards,

Many thanks.

Is there any way we could get
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><span style=“font-size:11.0pt;font-family:“Calibri”,“sans-serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:
“Times New Roman”;color:#1F497D;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”> a beta of the Aspose.Pdf for Java? so we could test to see if it will work for us. Our project has very tied schedule, otherwise, we’ve to look for a different library.
<!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Hi there,


Thanks for your inquiry. We have a good news for you, we have released the latest auto-ported version of Aspose.Pdf for Java. Please download and try latest Jar from download area and check following documentation link for adding a image to Pdf. Hopefully it will serve the purpose.


Please feel free to contact us for any further assistance.

Best Regards,

My testing indicates that emf still doesn’t work under aspose.pdf-new-4.0.0.jar
I attached text.emf

exception: java.lang.IllegalArgumentException: Invalid image or template handle in PlaceImage method.
at aspose.pdf.figure.Image.placeImage(Unknown Source)
at aspose.pdf.xml.ImageGenerator.writeImage(Unknown Source)
at aspose.pdf.xml.PageGenerator.a(Unknown Source)
at aspose.pdf.xml.b.a(Unknown Source)
at aspose.pdf.xml.GeneratorXml.generateDocument(Unknown Source)
at aspose.pdf.Pdf.save(Unknown Source)
//////////////////////////////////////////////////////////////////////////////////////
final aspose.pdf.Pdf pdf1 = new aspose.pdf.Pdf();

// Create a section in the Pdf object
final aspose.pdf.Section sec1 = pdf1.getSections().add();

// Create an image object in the section
final aspose.pdf.Image img1 = new aspose.pdf.Image();

// Add image object into the Paragraphs collection of the section
sec1.getParagraphs().add(img1);


img1.getImageInfo().setImageFileType(aspose.pdf.ImageFileType.Emf);

// Set the path of image file
img1.getImageInfo().setFile( “test.emf”);

// Set the path of image file
img1.getImageInfo().setTitle(“EMF image”);

// Save the Pdf
pdf1.save(“test.pdf”);

Hi,


The reason you are still getting the same error message with new autoported release because the aspose.pdf package shipped under aspose.pdf-3.3.jdk1x.jar file is same version as provided in last release of Aspose.Pdf for Java 3.3.0. The development team is still working on resolving the problem reported earlier as PDFJAVA-31650. As soon as we have made some progress towards its resolution, we would be more than happy to update you with the status of correction. Please be patient and spare us little time. We are really sorry for this inconvenience.

I’m confused - you mean that aspose.pdf-new-4.0.0.jar doesn’t support EMF yet?

I created testing by using new APIs:
com.aspose.pdf.Document pdfDocument1 = new com.aspose.pdf.Document();
com.aspose.pdf.Page page = pdfDocument1.getPages().add();
// load image into stream
java.io.FileInputStream imageStream =
new java.io.FileInputStream(
new java.io.File(“test.emf”));
// add image to Images collection of Page Resources
page.getResources().getImages().add(imageStream);
I got the exception:
class com.aspose.ms.System.c: Invalid image stream (Error loading file: Unsupported file format Parameter name: input).


yongshao:
I’m confused - you mean that aspose.pdf-new-4.0.0.jar doesn’t support EMF yet?
Hi,

The first release version 4.0.0 does not support the capability to convert EMF files to PDF format. However we plan to get this problem fixed in subsequent releases.

yongshao:

I created testing by using new APIs:
com.aspose.pdf.Document pdfDocument1 = new com.aspose.pdf.Document();
com.aspose.pdf.Page page = pdfDocument1.getPages().add();
// load image into stream
java.io.FileInputStream imageStream =
new java.io.FileInputStream(
new java.io.File(“test.emf”));
// add image to Images collection of Page Resources
page.getResources().getImages().add(imageStream);
I got the exception:
class com.aspose.ms.System.c: Invalid image stream (Error loading file: Unsupported file format Parameter name: input).

This problem has already been logged in our issue tracking system as PDFNEWJAVA-33464. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNEWJAVA-33464) have been fixed in Aspose.Pdf for Java 9.7.1.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.