Although not sure what you are doing, I have had success shelling out to PDFBox both in the web app process and also in a cron job to handle a queue. Doing it this way requires nothing at all special on the server other than a JRE.
HTH :-) On Wed, 10 Apr 2019 at 16:00, Greg Hanowski <[email protected]> wrote: > I added all the imports for the program on the stackoverflow page so you > can see where the row variable comes from. Also, the reason I know it > happens on that line is I step over the code line by line in the > NetBeans debugger, and the error happens right after stepping over > table.draw(); > > Greg > > On 4/10/2019 1:57 AM, GMAIL wrote: > > This should not be a problem, as the default constructor looks like this: > > public PDPage() { > > this(PDRectangle.LETTER); > > } > > 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... > > Attila > > > > ------ Eredeti üzenet ------ > > Feladó: "Gstöttner Siegfried" <[email protected]> > > Címzett: "[email protected]" <[email protected]> > > Elküldve: 2019. 04. 10. 9:40:30 > > Tárgy: AW: CORS error when running PDFBox from a web app > > > >> Hi, > >> > >> 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 > >> - > >> Siegfried Gstöttner > >> [email protected] > >> ++43 (0)662 8044 77392 > >> Universitätsbibliothek Salzburg, Bibliothekstechnologie > >> Hofstallgasse 2-4 > >> AT - 5020 Salzburg > >> AUSTRIA > >> > >> -----Ursprüngliche Nachricht----- > >> Von: Greg Hanowski [mailto:[email protected]] > >> Gesendet: Dienstag, 09. April 2019 19:22 > >> An: [email protected] > >> Betreff: Re: CORS error when running PDFBox from a web app > >> > >> Hi, > >> > >> 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 > >> > >> > https://stackoverflow.com/questions/55595975/why-getting-cors-error-in-boxable-pdfbox-table-draw > >> > >> > >> Greg > >> > >> 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: [email protected] > >>> For additional commands, e-mail: [email protected] > >>> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB� � > [��X��ܚX�K K[XZ[ � \�\��][��X��ܚX�P ��� �\ X� K�ܙ�B��܈ Y ] [ۘ[ ��[X[� > � K[XZ[ � \�\��Z [ ��� �\ X� K�ܙ�B� > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >

