I cannot seem to find any documentation which instructs how to do the above operation!
I tried the below code but it just sends the raw byte code to the browser.
Dim _url As String = "http://www.testing.com" Dim _pdf As Pdf = New Pdf() Dim _wb As WebClient = New WebClient Dim myBuffer() As Byte = _wb.DownloadData(_url) Dim _str As MemoryStream = New MemoryStream(myBuffer) _pdf.BindHTML(_str) _pdf.Save("test1.pdf", SaveType.OpenInBrowser, Response)
Hello Saleek,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for considering Aspose.
I have tested the issue using the code snippet that you have shared and in my case the Pdf is being generated. In fact the resultant Pdf is not as exact as input Aspx page, as currently this feature is in Beta version. Our development team is working hard over this issue, but I am afraid we cannot fully support this feature in short time. Sorry for your inconvenience.
Please try the following code snippet. We would recommend you to use the latest version of Aspose.Pdf 3.8.0.0
[VB.NET]
Dim pdf As Pdf = New Pdf()
'Create a section in the Pdf instance Dim sec1 As Aspose.Pdf.Section = pdf.Sections.Add()
'Create a Table object Dim pdfCurrentTable As Aspose.Pdf.Table = New Aspose.Pdf.Table(sec1)
Dim row0 As Aspose.Pdf.Row row0 = pdfCurrentTable.Rows.Add()
Dim cell0, cell1 As Aspose.Pdf.Cell cell0 = row0.Cells.Add()
'Create an image object Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image() 'Set the path of image file image1.ImageInfo.File = "c:\Temp\warning.png" 'Set the type of image using ImageFileType enumeration image1.ImageInfo.ImageFileType = ImageFileType.Png
row0.Cells(0).Paragraphs.Add(image1)
'Set the Default Border style pdfCurrentTable.DefaultCellBorder = New BorderInfo(BorderSide.All, 0.1F)
cell1 = row0.Cells.Add()
Dim s2 As String = "Second Cell" Dim t2 As Text = New Text(s2) row0.Cells(1).Paragraphs.Add(t2)
Is it possible to manipulate the size of the image container (not the image itself).
The problem i am facing is this...
I have high resolution images that I want to display in pdfs.
Currently, I resize them using GDI+ in asp.net.
This however reduces the quality substantially, which is not acceptable in my case.
So, I was wondering if i could avoid resizing the image and instead change the size of the container?? Or if there is another way to do this I would love to hear.
We recommend you use floating box as the image container. Here is the sample code. Please try it. Thanks.
[C#] Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf(); //Create a floating box to contain the image Aspose.Pdf.FloatingBox imagebox = new FloatingBox(); //Set the width/height of the floating box(container) //The same as the image’s width and height imagebox.BoxWidth = 200; imagebox.BoxHeight = 300; //Positioning the box imagebox.BoxHorizontalPositioning = BoxHorizontalPositioningType.Page; imagebox.Left = 100; imagebox.BoxVerticalPositioning = BoxVerticalPositioningType.Page; imagebox.Top = 250; //Add the image into the box Aspose.Pdf.Image img = new Image(); img.ImageInfo.File = “C:/images/1.jpg”; img.ImageInfo.ImageFileType = ImageFileType.Jpeg; imagebox.Paragraphs.Add(img); Aspose.Pdf.Section sec = pdf.Sections.Add(); sec.Paragraphs.Add(imagebox); pdf.Save(@“E:/temp/test.pdf”);
I have tested the issue and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFNET-6134. We will investigate this issue in detail and will keep you updated on the status of a correction. We apologize for your inconvenience.