안녕하세요, 회사 로고와 주소가 나란히 표시되는 송장을 만들려고합니다. 회사 로고가 왼쪽과 텍스트 아래에 표시됩니다. 나는 로고 옆에있는 텍스트를 아주 오른쪽으로 보려고했으나 오지 않았다. 도와주세요.이미지와 텍스트를 나란히 표시하는 방법 Itext
public class Test {
/** Path to the resulting PDF */
public static final String RESULT = "C:/ex/test.pdf";
/**
* Main method.
* @param args no arguments needed
* @throws DocumentException
* @throws IOException
*/
public static void main(String[] args) throws IOException, DocumentException {
new ComCrunchifyTutorials().createPdf(RESULT);
}
/**
* Creates a PDF with information about the movies
* @param filename the name of the PDF file that will be created.
* @throws DocumentException
* @throws IOException
*/
public void createPdf(String filename)
throws IOException, DocumentException {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
Image image = Image.getInstance("C:/Users/user/Desktop/New folder (3)/shoes/shoes/web/images/abc.jpg");
image.scaleAbsolute(150f, 50f);//image width,height
Paragraph p = new Paragraph();
Phrase pp = new Phrase(200);
p.add(new Chunk(image, 0, 0));
pp.add(" a text after the image.");
p.add(pp);
document.add(p);
document.close();
}
}
html로 pdf를 개조하는 것을 시도 했습니까? 당신의 심상 및 계산서를 가진 html 페이지를 만들고 그 후에 pdf에 html를 변환하는 것을 시도하십시오, 그것의 일 –