问题描述
我正在使用winovative免费试用许可证,我制作了一个pdf转换代码,以PDF格式下载base64图像,但它给我模糊和裁剪图像.cropped意味着图像不适合pdf文档?
为什么这是发生了吗?
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.Re。 place(Ÿ,+)
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
'pdfC onverter.PdfDocumentOptions.StretchToFit = True
'pdfConverter.DrawBackground = True
pdfBytes = pdfConverter.GetPdfBytesFromHtmlString(htmlreport)
Response_1.AddHeader(Content-type,application / pdf)
Response_1.AddHeader(Content-Disposition,附件; filename =+ ReportFileName
Response_1.BinaryWrite(pdfBytes)
Response_1.Flush()
Response_1 .End()
End Sub
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
推荐答案
这篇关于winovative PDf转换不工作AutoFit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!