I have a html file which is basically a tabular report , it can easily go into multiple pages. I have observed that the lower half gets cut when the content of the table increases.
How to remediate it . I am using the below code for this.
var options = new ImageSaveOptions
{
SmoothingMode = SmoothingMode.Default,
HorizontalResolution = 100,
VerticalResolution = 100,
BackgroundColor = Color.White,
};
int PageWidth = 1000, PageHeight = 1000;
options.PageSetup.AnyPage = new Page(new Aspose.Html.Drawing.Size(PageWidth, PageHeight));
//result is the variable which holds the html content.
var document = new Aspose.Html.HTMLDocument(result, “.”);
Aspose.Html.Converters.Converter.ConvertHTML(document, options, streamProvider);
Looks like the resulting PDF is generated using Aspose.Words. Can you please share the complete sample code snippet that we can use to replicate the same issue in our environment that you are facing?
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): HTMLNET-4682
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The logged ticket has been investigated and resolved. You can see its status at the bottom of this thread. We will be sharing its details with you shortly.
In the example, only the first of the streams is processed, so the result is only the first page : var memory = streamProvider.Streams.First();
In the case of multi-page documents, each page will be placed in a separate stream. Therefore, it is necessary to process them all.
var page = 0;
foreach(var memory in streamProvider.Streams)
{
memory.Seek(0, System.IO.SeekOrigin.Begin);
// Flush the result data to the output file
using (System.IO.FileStream fs = System.IO.File.Create("output_" + page +".jpg"))
{
memory.CopyTo(fs);
}
page++;
}
Thanks Asad, the issue looks to be resolved by this, but I am seeing quite a bit of white space . Am i missing something in the page size/configurations? image.png (27.2 KB)
An white space appears due to the insertion of an image into a Aspose.Words.Document. If you use the conversion directly to PDF, then there is no such problem:
var pdfOptions = new PdfSaveOptions()
{
HorizontalResolution = 100,
VerticalResolution = 100,
BackgroundColor = System.Drawing.Color.White,
};
var document = new Aspose.Html.HTMLDocument("StageSheet.html",new Aspose.Html.Configuration());
Aspose.Html.Converters.Converter.ConvertHTML(document, pdfOptions, streamProvider);
// Get access to the memory stream that contains the result data
using (var memory = streamProvider.Streams.First())
{
memory.Seek(0, System.IO.SeekOrigin.Begin);
// Flush the result data to the output file
using (System.IO.FileStream fs = System.IO.File.Create("output.pdf"))
{
memory.CopyTo(fs);
}
}
To clarify the options of the Word document, it is better to post in Aspose.Words forum.