pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <til...@apache.org>
Subject Re: CORS error when running PDFBox from a web app
Date Wed, 15 May 2019 18:36:36 GMT
In case anybody likes solved mysteries:

Further research on stackoverflow ( https://stackoverflow.com/questions/55595975/ , now deleted)
involved catching Throwable instead of specific exceptions, and brought a NoSuchMethodError.
The cause was a version mixup: "Unknown to me, my colleague was also using pdfbox in a different
part of the code. He uses classes in older jar that don't exist in newer jars."

Tilman

On 2019/04/09 17:08:22, Andreas Lehmkuehler <andreas@lehmi.de> 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


Mime
View raw message