Thanks for your time and for the tips, Maruan.
That was my intention, but I couldn't find how to set the COSDictionary
value directly... In PDFBox 1.x this was possible, I believe, but I'm not
seeing it in the 2.x version.

On Tue, Feb 25, 2020 at 7:02 PM Maruan Sahyoun <sahy...@fileaffairs.de>
wrote:

> What I would suggest is to create a barcode with the settings you would
> like to see applied in Adobe Acrobat and recreate that
> in PDFBox. There is no high level API in PDFBox for that so you need to
> work with the field and the widget annotation
> COSDirectory directly.
>
> You can start by creating a text field in PDFBox (as a barcode field is a
> subtype of that) and use getCOSObject() on the PD
> model field and widget object.
>
> As for the calculation you need to inject the correct JS code (again I'd
> do some prototyping in Acrobat) into the action
> dictionaries.
>
> From your response I get that you are aware that this will only work in
> Adobe Acrobat. To use it with Adobe Reader you need to
> ensure that the correct usage rights have been applied to the PDF before
> filling.
>
> There is a reason that you are looking to create the PDF form with PDFBox
> right?
>
> I've not done that before but feel free to ask further questions. My time
> is very limited these days but I'll try to help you as
> much as possible. Might also serve as a starter for an example.
>
> BR
> Maruan
>
>
>
> > Yes, that's correct.
> >
> > The end user is going to use Acrobat. I'm aware that this will not work
> in
> > Reader without some special rights applied to the file, but that is not
> > currently a concern.
> >
> > On Tue, Feb 25, 2020 at 5:39 PM Maruan Sahyoun <sahy...@fileaffairs.de>
> > wrote:
> >
> > > Hi Gilad,
> > >
> > > so if I understand you correctly you are creating a PDF form with
> PDFBox,
> > > maybe prefill it and later on a user is filling out
> > > the form interactively. Now some of the fields should contain a dynamic
> > > barcode with the value being calculated from some other
> > > fields values. Is that correct? What's the end users application for
> > > filling out the PDF?
> > >
> > > BR
> > > Maruan
> > >
> > > > The problem with that approach is that the image is static, while I
> want
> > > a
> > > > field whose value can be changed (based on the value of another
> field).
> > > >
> > > > On Tue, Feb 25, 2020 at 4:30 PM PDF Developer
> <pdf...@yahoo.com.invalid>
> > > > wrote:
> > > >
> > > > >  Hello Gilad,
> > > > >
> > > > > I suppose you could define a form button and assign the appearance
> to
> > > be
> > > > > an image file, generated perhaps from Barcode4J. I use that trick
> in
> > > > > Acrobat Pro to add content to PDFs, content I have scanned to PDF.
> > > > >
> > > > > I went down a different route and added barcodes as XObjects.
> Using the
> > > > > Okapi library, I wrote a very simple (no text) PDF Renderer based
> on
> > > their
> > > > > SVG one and took the output from that renderer and wrapped it as an
> > > XObject.
> > > > > PDFDev
> > > > >
> > > > >     On Tuesday, February 25, 2020, 3:09:57 PM GMT, Gilad Denneboom
> <
> > > > > gilad.denneb...@gmail.com> wrote:
> > > > >
> > > > >  Any ideas? I saw an old post of yours where you write that maybe
> this
> > > can
> > > > > be done with Barcode4J, but I think that would just generate the
> > > barcode as
> > > > > an image, not as a field.
> > > > >
> > > > > On Sun, Feb 23, 2020 at 11:20 PM Gilad Denneboom <
> > > > > gilad.denneb...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > DataMatrix
> > > > > >
> > > > > > On Sun, Feb 23, 2020 at 3:41 PM Maruan Sahyoun <
> > > sahy...@fileaffairs.de>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Gilad,
> > > > > > >
> > > > > > > what type of barcode would you like to generate?
> > > > > > >
> > > > > > > BR
> > > > > > > Maruan
> > > > > > >
> > > > > > > > Hi all,
> > > > > > > >
> > > > > > > > Does anyone have any pointers on how to create a Barcode
> field
> > > using
> > > > > > > PDFBox?
> > > > > > > > As far as I can see it's a text field, but with some special
> > > > > properties,
> > > > > > > > such as the PaperMetaData (PMD) object, and a calculation
> script
> > > with
> > > > > > > > specific JS code for copying the value from other fields.
> > > > > > > > I can handle the latter, but the former seems quite
> difficult to
> > > > > > > implement,
> > > > > > > > so any help would be appreciated.
> > > > > > > >
> > > > > > > > Thanks in advance,
> > > > > > > > Gilad
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
> > > > > > > For additional commands, e-mail: users-h...@pdfbox.apache.org
> > > > > > >
> > > > > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
> > > For additional commands, e-mail: users-h...@pdfbox.apache.org
> > >
> > >
> --
> Maruan Sahyoun
>
> FileAffairs GmbH
> Josef-Schappe-Straße 21
> 40882 Ratingen
>
> Tel: +49 (2102) 89497 88
> Fax: +49 (2102) 89497 91
> sahy...@fileaffairs.de
> www.fileaffairs.de
>
> Geschäftsführer: Maruan Sahyoun
> Handelsregister: AG Düsseldorf, HRB 53837
> UST.-ID: DE248275827
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
> For additional commands, e-mail: users-h...@pdfbox.apache.org
>
>

Reply via email to