Could you please tell me know whether I can convert the PDF to xHTML?
You may please use following code snippet in order to achieve your requirements.
var doc = new Document(dataDir + "input.pdf");
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
// Make Xhtml
saveOptions.DocumentType = HtmlDocumentType.Xhtml;
doc.Save(dataDir + "output.xhtml", saveOptions);
In case you face any issue, please share your sample PDF document with us. We will test the scenario in our environment and address it accordingly.
Thanks for the quick response. Will try with given source code.
can I have more details, like is it jar file of aspose.pdf or aspose.word. since i am not getting saveOptions.Document any of these.
In online PDF to XHTML converting pretty good but through Jar i am not able to convert. currently I am using Corrato Java 11.
Please help me to get solution for PDF to XHTML conversion like Aspose online conversion
You need to call saveOptions.setDocumentType() method in Java. It is available in Aspose.PDF for Java. In case you still face any issues, please let us know by sharing your sample document. We will further proceed to assist you accordingly.
there is method setDocumentType()
here is my code
Document pdfDocument = new Document(inputPDFFile);
// Instantiate HTML Save options object
HtmlSaveOptions options = new HtmlSaveOptions();
// options.setExportXhtmlTransitional(true);
// convert into XHTML format
options.setDocumentType(com.aspose.pdf.HtmlDocumentType.XHTML);
// pdfDocument.save(outputXHTMLFile, options);
pdfDocument.save(outputXHTMLFile);
getting Error: Cannot resolve method ‘setDocumentType’ in ‘HtmlSaveOptions’
Please make sure to initialize the HtmlSaveOptions with fully qualified namespace if you are using multiple Aspose APIs:
com.aspose.pdf.HtmlSaveOptions newOptions = new com.aspose.pdf.HtmlSaveOptions();
newOptions.setDocumentType(com.aspose.pdf.HtmlDocumentType.Xhtml);
Also, please make sure that you are using 23.12 version of the API. We are verifying these details while testing with the latest version.
Yes it was my mistake import was wrong. now it looks good thanks
It is nice to know that you were able to sort your issue out. Please feel free to create a new topic in case you need further assistance.