How to add CSS in Html to PDF conversion using Java

Hi Team,

I am using groupdoc conversion api for InputStream to Pdf conversion but not able to add css .
Please tell me how can we add css to converted pdf.

Many Thanks
Saras Kumar

@saras1234,

Please tell, are you trying to convert a HTML file to PDF?

Yes , I am trying to convert html to pdf and wants to add/apply css file for that pdf.

@saras1234,

We are investigating this. Your investigation ticket ID is CONVERSIONJAVA-817. As there is any update, you’ll be notified.

@saras1234,

In general if the HTML has image tags and/or <link type=“text/css” …/> they are automatically embedded. It will be helpful if you can provide an example HTML.

Hi Team,

I want to use below code for InputStream to pdf conversion :

InputStream inputStream = new ByteArrayInputStream(data);
ConvertedDocument convertedDocument = conversionHandler.convert(inputStream, new PdfSaveOptions());
convertedDocument.save(“converted from byte array.pdf”);
inputStream.close();

Please tell me how to get conversionHandler object and what configuration needs to set to ConversionConfig object.
Please help to asap so that we can go with the licenced version.

@saras1234,

Can you please further elaborate this?
What we understand is that you want to see how to instantiate ConversionConfig to set conversion configuration and how to create instance of ConversionHandler class to convert between different file formats, right?
If yes, please go through following resources:

Below are the configuration details.

ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setStoragePath(storagePath);
conversionConfig.setOutputPath(outputPath); 
// Instantiating the conversion handler
ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

If you give us more details, we can assist you accordingly.