Free Support Forum - groupdocs.com

Issue when converting html to pdf


#1

Hi Team,

I am using temporary licence and doing POC but first time it is converting html to pdf but next time getting following error message :

Exception in thread “main” class com.groupdocs.conversion.exception.GroupDocsException: DirectoryInfo was not created
com.groupdocs.conversion.handler.cache.local.a.getOutputSaveStreamInternal(Unknown Source)
com.groupdocs.conversion.operations.d.execute(Unknown Source)
com.groupdocs.conversion.converter.pdf.PdfConverter.convert(Unknown Source)
com.groupdocs.conversion.converter.pdf.PdfConverter.convert(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.aK(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
com.groupdocs.editor.examples.CommonConversion.convertToPdfAsFilePath(CommonConversion.java:27)
com.groupdocs.editor.examples.MainClass.main(MainClass.java:10)
at com.groupdocs.conversion.handler.cache.local.a.getOutputSaveStreamInternal(Unknown Source)
at com.groupdocs.conversion.operations.d.execute(Unknown Source)
at com.groupdocs.conversion.converter.pdf.PdfConverter.convert(Unknown Source)
at com.groupdocs.conversion.converter.pdf.PdfConverter.convert(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.aK(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
at com.groupdocs.editor.examples.CommonConversion.convertToPdfAsFilePath(CommonConversion.java:27)
at com.groupdocs.editor.examples.MainClass.main(MainClass.java:10)


#2

@saras1234,

In order to investigate this issue at our end, following details are required:

  • API version that you integrated in the project (e.g. 19.6, 19.10)
  • Problematic HTML file and the output PDF that you are getting first time
  • Sample code

#3

API version : 19.10
Sample code:
public void convertToPdfAsFilePath(String fileName) {
//ExStart:convertToPdfAsFilePath
// Instantiating the conversion handler
ConversionHandler conversionHandler = new ConversionHandler(Utilities.getConfiguration());
PdfSaveOptions saveOption = new PdfSaveOptions();
//set page mode and layout
saveOption.getPdfOptions().getFormatingOptions().setPageMode(PdfFormattingOptions.PdfPageMode.FullScreen);
saveOption.getPdfOptions().getFormatingOptions().setPageLayout(PdfFormattingOptions.PdfPageLayout.SinglePage);

	// Set absolute path to file
	String guid = fileName;

	ConvertedDocument convertedDocumentPath = conversionHandler.convert(guid, saveOption);
	convertedDocumentPath.save(fileName + "." + convertedDocumentPath.getFileType());
	System.out.print("Converted file path is: " + convertedDocumentPath);
	//ExEnd:convertToPdfAsFilePath
}<a class="attachment" href="/uploads/groupdocs/1456">Utilities.zip</a> (879 Bytes)

#4

@saras1234,

We cannot reproduce this issue at our end. Please see this screenshot.png (45.4 KB).
In order to further investigate it, we need the problematic HTML file. Please share that with us.