Click here to Skip to main content
15,886,680 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using winovative free trial licence and i make one pdf conversion code to download base64 image in pdf but it's give me blur and cropped image .cropped means image not fit in pdf document?
why this is happening?


Dim pdfDocument As Winnovative.WnvHtmlConvert.PdfDocument.Document = Nothing
'Dim pdfConverter_EVO As EvoPdf.PdfConverter = New EvoPdf.PdfConverter()
Dim pdfConverter As Winnovative.WnvHtmlConvert.PdfConverter = New Winnovative.WnvHtmlConvert.PdfConverter()
Dim pdfBytes As Byte() = Nothing

Dim htmlreport As String = ""
Dim ReportFileName As String = ""
Dim Response_1 As HttpResponse = Me.Response

htmlreport = Me.Request.Form.Item("ctl00$RPTHtml").ToString()
htmlreport = HttpUtility.UrlDecode(htmlreport)
htmlreport = htmlreport.Replace("Ÿ", "+")

Dim objReader As New System.IO.StreamReader(Server.MapPath("App_Themes/ext-all.css"))
Dim a As String = objReader.ReadToEnd
htmlreport = "<html><head><style type=""text/css"">" + a + "</style></head><body>" + htmlreport + "</body></html>"


Response_1.Clear()
Response_1.Buffer = True
Response_1.ClearContent()
Response_1.ClearHeaders()

ReportFileName = GetReportName() + ".pdf"

pdfConverter = New Winnovative.WnvHtmlConvert.PdfConverter()

pdfConverter.AvoidImageBreak = True
pdfConverter.AvoidTextBreak = True
pdfConverter.TruncateOutOfBoundsText = True
pdfConverter.LicenseKey = "7MfezN3M3MzbwtzM393C3d7C1dXV1Q=="
'pdfConverter_EVO.LicenseKey = "B4mYiJubiJiInIaYiJuZhpmahpGRkZE="
'pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4
pdfConverter.PdfDocumentOptions.FitWidth = True
pdfConverter.PdfDocumentOptions.FitHeight = True
'pdfConverter.PdfDocumentOptions.StretchToFit = True
'pdfConverter.DrawBackground = True

pdfBytes = pdfConverter.GetPdfBytesFromHtmlString(htmlreport)

Response_1.AddHeader("Content-type", "application/pdf")
Response_1.AddHeader("Content-Disposition", "attachment; filename=" + ReportFileName)

Response_1.BinaryWrite(pdfBytes)
Response_1.Flush()
Response_1.End()

End Sub
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900