我需要使用 ABCPDF 创建一个分层的 PDF 文件。我看过水印的例子,但我需要一个 PDF 作为第二层。我的代码如下。当我运行它时,我只看到一层。我做错了什么?
谢谢你。
WebSupergoo.ABCpdf8.Doc artworkDoc = new WebSupergoo.ABCpdf8.Doc();
artworkDoc.SetInfo(0, "License", _License);
WebSupergoo.ABCpdf8.Doc cutDoc = new WebSupergoo.ABCpdf8.Doc();
cutDoc.SetInfo(0, "License", _License);
// Attempt to read in Artwork File
try
{
artworkDoc.Read(ArtworkPath);
}
catch (Exception ex)
{
Exception noartwork = new Exception("Problem with Artwork File: " + ex.ToString());
throw noartwork;
}
// Attempt to read in cut File
try
{
cutDoc.Read(cutPath);
}
catch (Exception ex)
{
Exception nocut = new Exception("Problem with cut File: " + ex.ToString());
throw nocut;
}
WebSupergoo.ABCpdf8.Doc outputDoc = artworkDoc;
outputDoc.SetInfo(0, "License", _License);
// Attempt to merge artwork and cut files into output Document
try
{
outputDoc.PageNumber = 1;
outputDoc.Layer = outputDoc.LayerCount + 1;
outputDoc.AddImageDoc(cutDoc, 1, outputDoc.Rect);
}
catch (Exception ex)
{
Exception problem = new Exception("Problem appending cut and artwork files to output: " + ex.ToString());
throw problem;
}
// Attempt to save the output Document to the specified output path
try
{
outputDoc.Save(OutputPath);
artworkDoc.Clear();
cutDoc.Clear();
outputDoc.Clear();
}
catch (Exception ex)
{
Exception invalidOutput = new Exception("Unable to write output file: " + ex.ToString());
throw invalidOutput;
}
return true;
}