PDF를 가져올 때 iTextSharp가 페이지 상단에 흰색 덩어리를 추가합니다. 과 C#을 사용하여 작은 문제가 있습니다.
컨텍스트 : PDF를 다운로드하여 하나의 큰 파일로 병합합니다.
문제 : 모든 페이지에서 처음 몇 센티미터는 흰색이며 pd 가져 오기는 흰색 청크 뒤에 시작됩니다.
모든 페이지의 끝은 정확합니다. 겹치거나 누락 된 객체/텍스트가 없습니다. 적은 공간을 다루어야하기 때문에 가정합니다. 나는 그것이 수직으로 뻗을지도 모른다라고 생각한다.
그래서 가져 오기는 정상적으로 작동하지만 항상 모든 페이지 상단에 흰색의 몇 센티미터를 추가합니다. 상단 여백처럼 느껴집니다. 그러나 나는 그것을 고칠 수 없다.
아이디어가 있으십니까?
감사합니다. 고마워.
public void method()
{
// needed variables for the pdf-merging part
fs = new FileStream(Variables.destinationFile, FileMode.Create);
writer = PdfWriter.GetInstance(doc, fs);
doc.Open();
doc.SetPageSize(PageSize.A4);
doc.SetMargins(0f, 0f, 0f, 0f);
pdfContent = writer.DirectContent;
byte[] result;
int numPages;
foreach (Tuple<string, string, int> currentTuple in someArray)
try
{
result = client.DownloadData(new Uri(adress + currentTuple.Item1 + ".pdf"));
// read and add the pages to the output file
reader = new PdfReader(result);
numPages = reader.NumberOfPages;
for (int i = 1; i < numPages + 1; i++)
{
doc.NewPage();
page = writer.GetImportedPage(reader, i);
pdfContent.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
}
catch (Exception e)
{
}
}
doc.Close();
writer.Close();
fs.Close();
}
p.s. 왜 항상 내 "안녕하세요"를 삭제합니까? :)
"p.s :"http://meta.stackexchange.com/a/93989/266793 – DatRid