pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GMAIL <kiss.attila1...@gmail.com>
Subject Re: AW: CORS error when running PDFBox from a web app
Date Wed, 10 Apr 2019 07:57:29 GMT
This should not be a problem, as the default constructor looks like 
     public PDPage() {
So there is a mediabox. But there are other problems too, I can't see 
where the 'row' variable has declared.
And yet we did not see a stack trace. But probably this has nothing to 
do with pdfbox nor boxable...

------ Eredeti üzenet ------
Feladó: "Gstöttner Siegfried" <siegfried.gstoettner@sbg.ac.at>
Címzett: "users@pdfbox.apache.org" <users@pdfbox.apache.org>
Elküldve: 2019. 04. 10. 9:40:30
Tárgy: AW: CORS error when running PDFBox from a web app

>at your code at stackoverflow i noticed, you are trying to get the mediabox without setting
it before. I'm not very experieced in PdfBox, but maybe it would help to use a different constructor
for PDPage:
>PDPage page = new PDPage(PDRectangle.A4);
>Best regards,
>Siegfried Gstöttner
>++43 (0)662 8044 77392
>Universitätsbibliothek Salzburg, Bibliothekstechnologie
>Hofstallgasse 2-4
>AT - 5020 Salzburg
>-----Ursprüngliche Nachricht-----
>Von: Greg Hanowski [mailto:greg@enventive.com]
>Gesendet: Dienstag, 09. April 2019 19:22
>An: users@pdfbox.apache.org
>Betreff: Re: CORS error when running PDFBox from a web app
>Sorry for the formatting issues.  It didn't look like that mess when I
>clicked Send.
>I am aware of the many resources available on CORS issues.  The problem
>is there is too many.  I was hoping someone could explain why the error
>happens on the PDFBox BaseTable.draw() command, which would help narrow
>the scope of the problem.
>For an easy-to-read posting of this problem, see
>On 4/9/2019 11:08 AM, Andreas Lehmkuehler wrote:
>>  Hi,
>>  your mail is hard to read due to some obvious formatting issues.
>>  However it isn't necessary at all.
>>  It is a security issue. Simply search for "No
>>  'Access-Control-Allow-Origin' header is present on the requested
>>  resource". There are a lot of hints how to solve that issue depending
>>  on your environment.
>>  The described issue has nothing to do with PDFBox.
>>  Andreas
>>  Am 09.04.19 um 17:57 schrieb Greg Hanowski:
>>>  |table.draw(); |which is running on the server and has nothing to do
>>>  with the browser at that time. Here is the full code for perspective
>>>  |publicStringcreateDimCtrlPlanPdf(EnDatabasedb,intuserId,Stringdata){StringretVal
>>>  ="[]";try{// Set marginsfloatmargin =10;// Initialize
>>>  DocumentPDDocumentdoc =newPDDocument();PDPagepage
>>>  =newPDPage();doc.addPage(page);floatyStartNewPage
>>>  =page.getMediaBox().getHeight()-(2*margin);// Initialize
>>>  tablefloattableWidth
>>>  =page.getMediaBox().getWidth()-(2*margin);booleandrawContent
>>>  =false;floatyStart =yStartNewPage;floatbottomMargin
>>>  =70;BaseTabletable
>>>  =newBaseTable(yStart,yStartNewPage,bottomMargin,tableWidth,margin,doc,page,true,drawContent);//
>>>  Create Header rowbe.quodlibet.boxable.Row<PDPage>headerRow
>>>  =table.createRow(15f);be.quodlibet.boxable.Cell<PDPage>cell
>>>  =headerRow.createCell(100,"Dimensional Control
>>>  Plan");table.addHeaderRow(headerRow);// Create 6-column 2nd header
>>>  rowrow =table.createRow(15f);cell =row.createCell(10,"Lower
>>>  limit");cell =row.createCell(10,"Upper limit");cell
>>>  =row.createCell(15,"Rep.");cell =row.createCell(15,"Target");cell
>>>  =row.createCell(15,"Average limit");cell =row.createCell(15,"Standard
>>>  deviation max");cell =row.createCell(20,"the
>>>  drawing");table.draw();//CORS error occurs here when running on a
>>>  server which has been called by a web page// Close Stream and save
>>>  pdfFilefile =newFile("DimCtrlPlan.pdf");System.out.println("Sample
>>>  file saved at :
>>>  "+file.getAbsolutePath());//Files.createParentDirs(file);doc.save(file);doc.close();}catch(IOExceptionex){Logger.getLogger(EnCad.class.getName()).log(Level.SEVERE,null,ex);}catch(COSVisitorExceptionex){Logger.getLogger(EnCad.class.getName()).log(Level.SEVERE,null,ex);}returnretVal;}
>>>  Any suggestions? |||
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>  For additional commands, e-mail: users-help@pdfbox.apache.org
>To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>For additional commands, e-mail: users-help@pdfbox.apache.org
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message