iTextSharp - 另请阅读第二页

时间:2016-12-15 10:15:49

标签: vb.net itext

我是新来的。我正在编写程序并使用itextsharp。我想导入各种文件,然后保存。不幸的是我没有得到它,第二页被阅读。编辑第一页kappt super。这是我的代码:

<!DOCTYPE html>
<html class="not-ie" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>41160278</title>
<script type="text/javascript">
function applyFormat(self){

    var input = self.value;
    var firstPart = input.substr(0,4);
    var lastPart  = input.substr(5, input.length);

    formname.forShow.value = firstPart.replace(firstPart, '*****') + lastPart;

    formname.forStore.value = input;

}
</script>
</head>

<body>
<form action="#" name="formname">
    <fieldset>
        <input type="text" name="forShow" maxlength="8"    onchange="applyFormat(this)" value="" />
        <input type="hidden" name="forStore" value="" />
    </fieldset>
</form>
</body>
</html>

关于方法,解决方案或帮助我会非常高兴并提前感谢您

莫里斯

1 个答案:

答案 0 :(得分:0)

这是我用来将新页面添加到目标文档的方法。

 'myarray is the document to be added,   mydoc is the document added to   

Public Function AdddbFiletoDoc(myarray() As Byte, mydoc As Document, mywriter As PdfWriter, mycb As PdfContentByte)
    Dim myreader As New PdfReader(myarray)
    Dim numofPages As Integer = myreader.NumberOfPages, mypage As PdfImportedPage
    Dim currpage As Integer = 0
    Do While currpage < numofPages
        currpage += 1
        mydoc.SetPageSize(PageSize.A4)
'You can add a flag to the method to determine if you want a new page or not
        mydoc.NewPage()
        mypage = mywriter.GetImportedPage(myreader, currpage)
        mycb.AddTemplate(mypage, 1.0F, 0, 0, 1.0F, 0, 0)
    Loop

End Function