如何使用iTextSharp查找pdf高度和pdf宽度 [英] How to find pdf height and pdf width using iTextSharp
本文介绍了如何使用iTextSharp查找pdf高度和pdf宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友们,
在我的窗口应用程序中我使用Quick pdf查找高度,宽度为pdf.please参考下面的代码。但有时候quickpdf可以'能够找到正确的值。所以我想使用iTextSharp完成任务。如何使用iTextSharp找到pdf的高度,宽度?
Dear Friends,
In my window application i am using Quick pdf to find height,width of pdf.please refer the below code.But sometimes quickpdf can't able to find correct value.so i want to do the task using iTextSharp. How to find pdf height,width using iTextSharp?
Try
Dim qp1 As New iSED.QuickPDF
Dim sPDFHei, sPDFWid As Double
Dim iPgCnt As Integer
qp1.UnlockKey("6510E9D5C3938A920B3A8D7293C6DF00")
qp1.LoadFromFile(sFilePath & "\" & cmbArticles.Text)
qp1.SetMeasurementUnits(0)
iPgCnt = qp1.PageCount
For i As Integer = 1 To iPgCnt
'MsgBox("pagecount=" & iPgCnt)
qp1.SelectPage(i)
'MsgBox("PageNumber=" & i)
sPDFHei = qp1.PageHeight : sPDFWid = qp1.PageWidth
sPDFHei = Math.Round(sPDFHei, 2) : sPDFWid = Math.Round(sPDFWid, 2)
''If sPDFWid <> 8.26 And sPDFHei <> 11.69 Then
If sPDFWid > 520 Or sPDFHei > 600 Then
MsgBox("Article PDF size should not exit 7.22 x 8.33" & vbCrLf & "Problem in template:" & i)
Exit Function
End If
Next
qp1.clear()
Checkpdfsize = True
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "CheckPdfSize")
End Try
推荐答案
发布此解决方案,因为您的问题已在StackOverflow的交叉发布中得到解答。 http://stackoverflow.com/questions/22111474/find-height-and- width-of-pdf-using-itextsharp [ ^ ]
你可能会发现这些 stackoverflow [ ^ ]引用也很有用。
Posting this solution as your question has been answered on your cross-post at StackOverflow.http://stackoverflow.com/questions/22111474/find-height-and-width-of-pdf-using-itextsharp[^]
You may find these other stackoverflow[^] references useful too.
这篇关于如何使用iTextSharp查找pdf高度和pdf宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文