篮板 我没把代码贴全!
If e.filename.Contains(".pdf") Then
Dim ftp As New FTPClient
ftp.host=vars("FTP_ip地址")
ftp.Account =vars("FTP_账号")
ftp.password =vars("FTP_密码")
ftp.Port= vars("FTP_端口")
' ftp.RootDir = "\图片文件\" & n '设置根目录
If ftp.Download(e.FileName,"e:\downpdf.pdf") = True Then
Dim fn As String = "e:\downpdf1.pdf"
Dim waterMarkName As String = "TBFC " & User_ReName & " " & Date.now
Dim reader As New iTextSharp.text.pdf.PdfReader("e:\downpdf.pdf")
Dim msWater As new io.FileStream(fn, io.FileMode.Create)
Dim total As Integer = reader.NumberOfPages
Dim pdfStamper As new iTextSharp.text.pdf.PdfStamper(Reader, msWater)
Dim psize = Reader.GetPageSize(1)
Dim width = psize.Width
Dim height = psize.Height
Dim gs As new iTextSharp.text.pdf.PdfGState
Dim basefont As iTextSharp.text.pdf.BaseFont = iTextSharp.text.pdf.BaseFont.CreateFont("C:\WINDOWS\Fonts\SIMYOU.TTF", iTextSharp.text.pdf.BaseFont.IDENTITY_H, iTextSharp.text.pdf.BaseFont.NOT_EMBEDDED)
For i As Integer = 1 To total
Dim waterContent = pdfStamper.GetOverContent(i)
waterContent.SetGState(gs)
waterContent.BeginText()
waterContent.SetColorFill( iTextSharp.text.BaseColor.RED)
waterContent.SetFontAndSize(basefont, 28)
waterContent.SetTextMatrix(0, 0)
waterContent.ShowTextAligned(iTextSharp.text.Element.ALIGN_CENTER, waterMarkName, width / 2, height / 2, 55)
waterContent.EndText()
Next
pdfStamper.close
reader.Close() '这里 加了水印 再另存的' e.FileName = fn '但是来到这里 就报错了 ,说 路径 有问题
End If
End If
此主题相关图片如下:捕获.jpg
'----------------------------------------------------'
If e.filename.Contains(".pdf") Then
Dim ftp As New FTPClient
ftp.host=vars("FTP_ip地址")
ftp.Account =vars("FTP_账号")
ftp.password =vars("FTP_密码")
ftp.Port= vars("FTP_端口")
' ftp.RootDir = "\图片文件\" & n '设置根目录
If ftp.Download(e.FileName,"e:\downpdf.pdf") = True Then
Dim fn As String = "e:\downpdf.pdf"
e.FileName = fn
End If
End If
'----------------------------------------------------'
直接这么写 也一样的错误
[此贴子已经被作者于2020/1/6 12:13:19编辑过]