You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Varshal (JIRA)" <ji...@apache.org> on 2016/11/21 05:06:58 UTC
[jira] [Comment Edited] (PDFBOX-3580) Not able to write content
using PDPageContentStream while drawing BaseTable
[ https://issues.apache.org/jira/browse/PDFBOX-3580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15682538#comment-15682538 ]
Varshal edited comment on PDFBOX-3580 at 11/21/16 5:06 AM:
-----------------------------------------------------------
I am using BoxAble library to draw table.
I am creating pdf of 3-4 pages, by saying "save a page", I mean, when I save content and table in same page, the content don't show up.
I have attached code for reference.
try {
cos.setFont(paraFont, 10);
cos.beginText();
cos.newLineAtOffset(page.getMediaBox().getWidth() - 550, page.getMediaBox().getHeight() - 200);
cos.showText("Vault : " + VaultName);
cos.endText();
cos.beginText();
cos.newLineAtOffset(page.getMediaBox().getWidth() - 550, page.getMediaBox().getHeight() - 230);
cos.endText();
cos.close();
} catch (IOException ioe){
ioe.printStackTrace();
}
recordsTable = createTable(content[i].getList(), content[i].getLimit());
public BaseTable createTable(List<Data> dataList, HashMap<String, Integer> limit) throws IOException {
page = new PDPage();
page.setMediaBox(new PDRectangle(600, 850));
document.addPage(page);
float margin = page.getMediaBox().getWidth() - 550;
float tableWidth = page.getMediaBox().getWidth() - 100;
float yStartNewPage = page.getMediaBox().getHeight() - 250;
float yStart = yStartNewPage;
float bottomMargin = 10;
BaseTable recordsTable = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth, margin, document, page, true, true);
DataTable dt = new DataTable(recordsTable, page);
//dt.addListToTable(recordList, false);
List<List> dataTable = new ArrayList<List>();
dataTable.add(new ArrayList<>(Arrays.asList("Sr No", "Data Id",
"Total Pages")));
int i=0;
for (Data currData : dataList) {
i++;
dataTable.add(new ArrayList<>(Arrays.asList(i, currData.getId(), currData.getPages())));
}
dt.addListToTable(dataTable, true);
return recordsTable;
}
was (Author: varshal):
I am using BoxAble library to draw table.
I am creating pdf of 3-4 pages, by saying "save a page", I mean, when I save content and table in two different pages, the content don't show up.
I have attached code for reference.
try {
cos.setFont(paraFont, 10);
cos.beginText();
cos.newLineAtOffset(page.getMediaBox().getWidth() - 550, page.getMediaBox().getHeight() - 200);
cos.showText("Vault : " + VaultName);
cos.endText();
cos.beginText();
cos.newLineAtOffset(page.getMediaBox().getWidth() - 550, page.getMediaBox().getHeight() - 230);
cos.endText();
cos.close();
} catch (IOException ioe){
ioe.printStackTrace();
}
recordsTable = createTable(content[i].getList(), content[i].getLimit());
public BaseTable createTable(List<Data> dataList, HashMap<String, Integer> limit) throws IOException {
page = new PDPage();
page.setMediaBox(new PDRectangle(600, 850));
document.addPage(page);
float margin = page.getMediaBox().getWidth() - 550;
float tableWidth = page.getMediaBox().getWidth() - 100;
float yStartNewPage = page.getMediaBox().getHeight() - 250;
float yStart = yStartNewPage;
float bottomMargin = 10;
BaseTable recordsTable = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth, margin, document, page, true, true);
DataTable dt = new DataTable(recordsTable, page);
//dt.addListToTable(recordList, false);
List<List> dataTable = new ArrayList<List>();
dataTable.add(new ArrayList<>(Arrays.asList("Sr No", "Data Id",
"Total Pages")));
int i=0;
for (Data currData : dataList) {
i++;
dataTable.add(new ArrayList<>(Arrays.asList(i, currData.getId(), currData.getPages())));
}
dt.addListToTable(dataTable, true);
return recordsTable;
}
> Not able to write content using PDPageContentStream while drawing BaseTable
> ---------------------------------------------------------------------------
>
> Key: PDFBOX-3580
> URL: https://issues.apache.org/jira/browse/PDFBOX-3580
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.1
> Environment: Windows 10 - 64 bit,
> Reporter: Varshal
>
> I am drawing BaseTable on a page where I am writing some content using PDPageContentStream on the same page.
> When I save this page, content is not stored on the page.
> Is it overwritten by BaseTable?
> The issue is not reflected when I use two different pages in same document.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org