Hi,
We are generating a PDF document by inserting an HTML Fragment in the PDF.
Our requirement is to rotate an image or text while inserting the same in PDF.
Below is the HTML Code that was used as an HTML fragment and was inserted in the PDF.
<head>
<style>
.rotate90 {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.year
{
display:block;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); //For IE support
}
</style>
</head>
<body>
<div class="example-date">
<span class="day">31</span>
<span class="month">July</span>
<span class="year">2010</span>
</div>
<img id="image_canv" src="webwb/AIGIndia.png" class="rotate90">
</body>
As you can see the generated PDF has all the content that was supposed to be included in it but without the intended rotation.
The same HTML code when rendered on the browser it provides the rotation to the content as the code shuld have.Attached is the screenshot of the browser page rendered through the same HTML code.
Please provide a resolution for the issue.
The version of Aspose PDF being used is 17.1.0.0
Testing (3) (2).pdf (2.5 KB)
Rotation Test.png (10.8 KB)
@rhustead
Thanks for contacting support.
We have tested the scenario in our environment by using both HtmlFragment
and following approach, but did not get success to produce desired result.
HtmlLoadOptions loadoptions = new HtmlLoadOptions(dataDir);
loadoptions.PageInfo.Height = Aspose.Pdf.PageSize.PageLetter.Height;
loadoptions.PageInfo.Width = Aspose.Pdf.PageSize.PageLetter.Width;
loadoptions.PageInfo.Margin.Left = 70;
loadoptions.PageInfo.Margin.Top = 30;
string HTMLcontent = @"<html>
<head>
<style>
.rotate90 {
-webkit - transform: rotate(90deg);
-moz - transform: rotate(90deg);
-o - transform: rotate(90deg);
-ms - transform: rotate(90deg);
transform: rotate(90deg);
}
.year
{
display: block;
-webkit - transform: rotate(-90deg);
-moz - transform: rotate(-90deg);
filter: progid: DXImageTransform.Microsoft.BasicImage(rotation = 3); //For IE support
}
</style>
</head>
<body>
<div class='example-date'>
<span class='day'>31</span>
<span class='month'>July</span>
<span class='year'>2010</span>
</div>
<img id = 'image_canv' src='aspose.jpg' class='rotate90'>
</body></html>";
MemoryStream ms = new MemoryStream();
TextWriter tw = new StreamWriter(ms);
tw.Write(HTMLcontent);
tw.Flush();
ms.Seek(0, SeekOrigin.Begin);
Document doc = new Document(ms, loadoptions);
doc.Save(dataDir + "RotatedContent.pdf");
Therefore, we have logged an issue as PDFNET-43422 in our issue tracking system. We will further investigate the issue and will keep you posted with the status of its rectification. Please be patient and spare us little time.
We are sorry for the inconvenience.