We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Splitting charts from Single HTML file to Multiple PDF Pages(Single File)

Hi,


I have some Queries regarding Aspose.Pdf.

1. I have 3 charts in single input HTML file(attached).
I want to convert the Html into Single PDF File but all charts in different pages.

2. I’m using HtmlFragments to read multiple html input files which contains Html Charts,
I’m able to convert those files into single pdf page/file.
But is there any way i can make borders around each chart (each chart is coming through seperate html fragment) in output Pdf file??


If it’s possible please share the code snippet for the same.

Thanks,
Ashutosh

Hi Ashutosh,


Thanks for contacting support.

anshushukla.shukla:
1. I have 3 charts in single input HTML file(attached).
I want to convert the Html into Single PDF File but all charts in different pages.

We have logged an investigation ticket as PDFNET-42888 in our issue tracking system for the requirement. Development team will further investigate the feasibility of the feature and as soon as we have some feedback from their side, we will inform you. Please be patient and spare us little time.

anshushukla.shukla:
I’m using HtmlFragments to read multiple html input files which contains Html Charts,
I’m able to convert those files into single pdf page/file.
But is there any way i can make borders around each chart (each chart is coming through seperate html fragment) in output Pdf file??

You can add HtmlFragment inside a table cell and set cell borders, in order to get the desired results. Please check following code snippet where I have added two different HtmlFragment(s) from different files with borders, inside a PDF.

Document doc = new Document();<o:p></o:p>

Page currpage = doc.Pages.Add();

HtmlFragment htmlFrag1 = new HtmlFragment(File.ReadAllText(dataDir + "input1.html"));

HtmlFragment htmlFrag2 = new HtmlFragment(File.ReadAllText(dataDir + "input2.html"));

Table table = new Table();

table.ColumnAdjustment = ColumnAdjustment.AutoFitToWindow;

table.DefaultCellBorder = new BorderInfo(BorderSide.All, 0.5f);

table.DefaultCellPadding = new MarginInfo(2, 2, 2, 2);

Row row = table.Rows.Add();

Cell cell = row.Cells.Add();

cell.Paragraphs.Add(htmlFrag1);

row = table.Rows.Add();

cell = row.Cells.Add();

cell.Paragraphs.Add(htmlFrag2);

currpage.Paragraphs.Add(table);

doc.Save(dataDir + "HtmlFragWithBorder_out.pdf");



For your reference, I have also attached an output generated by above code.


Best Regards,

Hi Asad,

Thanks for the code example and output file.
It’s working fine.

About the first issue: If it is possible for you at Aspose its ok otherwise i have tried another workaround for that task so if it’s not possible then no issues. :slight_smile:

Thanks for the help.

-Ashutosh

Hi Ashutosh,


Thanks for your feedback.

It is good to know that suggested code worked for you. Where as regarding the logged issue, development team will definitely investigate the possibility of the requirement and as soon as we have some significant feedback from their side, we will inform you within this forum thread.

Please keep using our API and in case of any further assistance, feel free to contact us.


Best Regards,