Hi @all,
i have a requirement to add a table as frist paragrah into an exisiting pdf Document, The content should be started under the new inserted Table. How can i archive this?
For your info: I have a pdf document using html to pdf conversion,
var pdfFromHtml = new Aspose.Pdf.Document(new MemoryStream(htmlAsByteArray), options);
in this pdfFromHtml I want to add a table as first paragraph.
I also have an existing Aspose.Pdf.Table with all information. How can I put this table object as frirst element?
regards
Micha
Hi Micha,
Thanks for your inquiry. You may create a new PDF document with blank page, add your table in the page and later add your
html into the page using HtmlFragment. It will help you to accomplish the task.
Please feel free to contact us for any further assistance.
Best Regards,
Hi,
i think that's not possible, because I must have used:
var pdfFromHtml = new Aspose.Pdf.Document(new MemoryStream(htmlAsByteArray), options);
I need the Option in this way
var options = new HtmlLoadOptions
{
CustomLoaderOfExternalResources = delegate(string uri)
{
[...]
To embed the <img src... The images com frome an array so at the moment I don't need to save the images on disc. I can search for with the uri in my array,
If i have to use the HtmlFragment, I don't habe this possibility, isn't it? I only see the HtmlSourceBasePath or something like that, but therefore I have to save the images from my in memory array on disc. That is not the way I want to do...
Any suggestions?
regards Micha
Hi Micha,
Thanks for sharing the details.
As per my understanding from above description, you need the feature to load img files through Byte Array when using HtmlFragment. A feature which is currently supported when we Convert HTML to PDF - Resource Loading Callback. Please acknowledge so we may further look into this matter.
Hi,
first of all I have found the corresponding feature with HtmlFragment. Even HtmlFragment have an CallBack Option.
var fragment = new HtmlFragment(ANY HTML);
var options = new HtmlLoadOptions
{
CustomLoaderOfExternalResources = delegate(string uri)
{
var filename = Path.GetFileName(uri);
if (filename == null) return null;
byte[] resultBytes;
_files.TryGetValue(filename, out resultBytes);
var result = new Aspose.Pdf.LoadOptions.ResourceLoadingResult(resultBytes);
return result;
}
};
fragment.HtmlLoadOptionsOfInstance = options;
When adding this “Paragraph” “fragment” to my exisiting pdf Page, then the html content doesn’t fit in page! Even with A4 Width and A4 height the html content is not resized in the PDF.
So in the moment I have only 2 options:
1: Have my HTML Content starting on a new Page after my exisiting content
2: Have my HTML Content directly below my existing content, but not all will see because it is not in A4 format.
Any hints?
regards Micha
Hi Micha,
Thanks for your feedback. Yes you are right, currently we can not set width/height of resultant PDF document less than minimal width/height of actual html page during HTML to PDF conversion. However we will appreciate it if you please share your sample code along with source document(HTML), we will look into it and will guide you accordingly.
We are sorry for the inconvenience.
Best Regards,