我創建了一個包裝類使用我米試圖用VBScript來執行它的包裝..VBSCRIPT問題:執行的VBScript與
這裏訪問使用PDFBox的,PDF表單,包裝類的幫助是我的包裝類(類庫)與COM啓用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using org.apache.pdfbox.pdmodel;
using org.apache.pdfbox.util;
using org.apache.pdfbox.pdmodel.interactive.form;
namespace PDF.API
{
public class PDFDocument
{
private PDDocument PD;
public void load(string PDFPath)
{
PD = PDDocument.load(PDFPath);
}
public PDDocumentCatalog getDocumentCatalog()
{
return PD.getDocumentCatalog();
}
public void save(string PDF_Path)
{
PD.save(PDF_Path);
}
public void close()
{
PD.close();
}
}
,這裏是我的VBScript
Set TestPDF = CreateObject("PDF.API.PDFDocument")
Set test = PDFDocument.load("D:\\PDF_FORMS\\sample_form.pdf")
Set PDDocumentCatalog = test.getDocumentCatalog()
Set PDAcroForm = PDDocumentCatalog.getAcroForm()
Set PDFField = PDAcroForm.getField("Forenames")
PDField.setValue("VBSCRIPT")
test.save("D:\\PDF_FORMS\\a.pdf")
test.close()
現在它拋出我對象需要PDDocument
能不能夠解決這個問題 任何一個可以幫助我,請
感謝
設置TestPDF =的CreateObject( 「PDF.API.PDFDocument」) 設置測試= PDFDocument.load( 「d:\\ \\ PDF_FORMS sample_form.pdf」) 即使我嘗試PDFDocument wrapperclass名它包含load方法,會引發PDFDocument所需的同一對象 – Ganeshja 2013-03-20 14:20:41
即使您將**對象變量** PDDocument重命名爲PDFDocument,您仍然不會在任何地方初始化該變量。查看更新的答案。 – 2013-03-20 15:18:47