Barcode Plugin Development: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
No edit summary
(34 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Discussion Index}} [[Category:Development]][[Category:EN]]
{{Discussion Index}} [[Category:Development]][[Category:EN]]
The [http://documentation.scribus.net/index.php/Barcode_Generator barcode plugin] does not currently provide all of the functionality that is available in the underlying library, [http://www.terryburton.co.uk/barcodewriter/ Barcode Writer in Pure PostScript] (BWIPP).


This page is intended to provide a collaboration point to coordinate improvements to the barcode plugin. Please extend, debate and discuss as appropriate.
This page is intended to provide a collaboration point to coordinate improvements to the [http://documentation.scribus.net/index.php/Barcode_Generator barcode plugin] which is based on [http://bwipp.terryburton.co.uk Barcode Writer in Pure PostScript] (BWIPP). Please extend, debate and discuss as appropriate.


==Simple tasks==
The BWIPP wiki provides [https://github.com/bwipp/postscriptbarcode/wiki/Developing-a-Frontend-to-BWIPP some recommendations for frontends].


* Switch from the monolithic flavour of BWIPP to the monolithic-package flavour which is functionally equivalent, more suited to distribution and DSC-conforming. Has been tested by replacing the existing barcode.ps and works as expected. Description of the available flavours [https://code.google.com/p/postscriptbarcode/#Download here].
==Scribus tasks==
* Hexify the data and options string input from Scribus to BWIPP to prevent PostScript injection by means of unescaped ")" or otherwise. See this discussion [https://bitbucket.org/whosaysni/elaphe/issue/18/make-codestring-optionstring-hexilified here].
* Add an advanced checkbox that allows the user to directly provide the options string to the library for advanced users who follow the [https://code.google.com/p/postscriptbarcode/wiki/Symbologies BWIPP reference].


==Moderate tasks==
* <s>Hexify the data and options string input from Scribus to BWIPP to prevent PostScript injection by means of unescaped ")" or otherwise. See this discussion [https://bitbucket.org/whosaysni/elaphe/issue/18/make-codestring-optionstring-hexilified here].</s> NOW MERGED
 
* <s>Add an advanced textbox that allows the user to directly provide the options string to the library for advanced users who follow the [https://github.com/bwipp/postscriptbarcode/wiki BWIPP reference].</s> NOW MERGED
* Add support for the remaining barcode symbologies supported by BWIPP: ISMN, ISSN, GS1 DataBar barcodes, SSCC-18, EAN-14, GS1 Composite barcodes (EAN/UPC, GS1 DataBar and GS1-128), Data Matrix, GS1 DataMatrix, Aztec Code, PDF417, MicroPDF417, MaxiCode, Codablock F, Code 16K, Code 49, Code One, USPS PLANET, USPS Intelligent Mail, USPS FIM, Royal Mail, Royal TNT Post, Japan Post, Australia Post, Deutsche Post Identcode, Deutsche Post Leitcode, Pharmacode, Two-track Pharmacode, Code 32, Pharmazentralnummer, Code 39 Full ASCII, Code 93, Code 93 Full ASCII, Code 11, Codabar, Telepen, Channel Code, PosiCode, BC412, HIBC barcodes.
* <s>Add support for the remaining barcode symbologies that are supported by BWIPP.</s> NOW MERGED
* To make the presentation of the list of barcode formats manageable we should sort the list of barcodes in the same/similar way as the web-based generator [http://www.terryburton.co.uk/barcodewriter/generator/ here].
* <s>To make the presentation of the list of barcode formats manageable we should sort the list of barcodes in the same/similar way as the web-based generator [http://www.terryburton.co.uk/barcodewriter/generator/ here].</s> NOW MERGED
* Use the BWIPP error reporting mechanism to provide specific error messages to users. For example, the following PS procedure can be used to invoke barcode.ps and on error halt with descriptive text (e.g. "BWIPP ERROR: EAN-13 must be 12 or 13 digits") sent to STDERR:
** <s>The list is still long and may be unworkable on certain platforms. Consider a multi-combo approach or other.</s> NOW MERGED
  %!PS
* <s>Extract descriptions, example data and example options from the barcode.ps metadata by scanning for DESC, EXAM and EXOP stanzas within BEGIN/ENCODER ENCODER blocks.</s> NOW MERGED
  errordict begin
* <s>Use the BWIPP error reporting mechanism to provide specific error messages to users so that they can understand why a given input is invalid.</s> NOW MERGED
  /handleerror {
* <s>Render the preview in a background QThread so that updating the preview image doesn't snatch attention away from the UI. See [http://lists.scribus.net/pipermail/scribus-dev/2015-February/002487.html here].</s> NOW MERGED
    $error begin
* Allow the location of the barcode.ps file to be configured by the user so that non-admins users can provide a local version and distributions that deprecate bundled libraries can provide a separately packaged version. cbradney TO REVIEW.
    errorname dup length string cvs 0 6 getinterval (bwipp.) eq {
* Create a new type of Scribus Barcode Item:
      (%stderr) (w) file
** A vector item that cannot be ungrouped
      dup (\nBWIPP ERROR: ) writestring
** Initially fixed aspect ratio
      dup errorname dup length string cvs writestring
** Stores the value behind the created barcode: codeEdit, optionsEdit, lnColor, bgColor, txtColor (Checkbox states unnecessary as encoded in optionsEdit)
      dup ( ) writestring
** Ideally, double-clicking on such an item would bring up the barcode dialogue (not the Group Tab of the PP), so that a user can change the data, and the barcode drawing would be updated after clicking an "Update" button. This would, obviously, require some extensions to the Scribus core, as well as changes to the file format.
      dup errorinfo dup length string cvs writestring
* Allow the barcode plugin to be driven from ScripterNG.
      dup (\n) writestring
      dup flushfile end quit
    } if
    end //handleerror exec
  } bind def
  end
  % If necessary, set up anything specific to the environment here.
  (barcode.ps) run
* Allow the location of the barcode.ps file to be configured by the user so that non-admins users can provide a local version and distributions that deprecate bundled libraries can provide a separately packaged version. A possible search order that achieves this:
# User defined location specified via some dialog (PATH_TO_BARCODE_PS=USER|DEFAULT), if set to USER, otherwise:
# ~/.scribus/plugins/barcode.ps
# [APP_INSTALL_DIR]/share/scribus/plugins/barcode.ps
# /usr/share/postscriptbarcode/barcode.ps (Fedora's postscriptbarcode package)
# /usr/share/libpostscriptbarcode/barcode.ps (Debian's libpostscriptbarcode package)
 
==Harder tasks==
 
* Support new barcode formats automatically by scanning the barcode.ps metadata for BEGIN/END ENCODER blocks.
* Extract descriptions, example data and example options from the barcode.ps metadata by scanning for DESC, EXAM and EXOP stanzas within BEGIN/ENCODER ENCODER blocks.
 
Example barcode.ps metadata for an encoder:
 
  % --BEGIN ENCODER ean8--
  % --REQUIRES preamble raiseerror renlinear ean5 ean2--
  % --DESC: EAN-8
  % --EXAM: 02345673
  % --EXOP: includetext guardwhitespace
  % --RNDR: renlinear
  ... PostScript resource definition here ...
  % --END ENCODER ean8--


==Collaborative tasks==
==Collaborative tasks==


The following require close coordination between Scribus and BWIPP.
The following tasks require some degree of coordination between Scribus and [[User:Terryburton|Terry Burton]], the author of BWIPP.


* Extend the barcode.ps metadata to describe the options that are available for each encoder so that any frontends such as the Scribus plugin can be light on compiled in data and enhanced by simply replacing the barcode.ps file.
* Extend the barcode.ps metadata to describe the options that are available for each encoder so that any frontends such as the Scribus plugin can be light on compiled in data and enhanced with new format by simply replacing the barcode.ps file. [IN PROGRESS UPSTREAM - https://github.com/bwipp/postscriptbarcode/tree/master/libs]

Revision as of 12:54, 16 October 2015

This article is part of the Ongoing Discussions series.
Installation Usability MacOS Fonts Other

This page is intended to provide a collaboration point to coordinate improvements to the barcode plugin which is based on Barcode Writer in Pure PostScript (BWIPP). Please extend, debate and discuss as appropriate.

The BWIPP wiki provides some recommendations for frontends.

Scribus tasks

  • Hexify the data and options string input from Scribus to BWIPP to prevent PostScript injection by means of unescaped ")" or otherwise. See this discussion here. NOW MERGED
  • Add an advanced textbox that allows the user to directly provide the options string to the library for advanced users who follow the BWIPP reference. NOW MERGED
  • Add support for the remaining barcode symbologies that are supported by BWIPP. NOW MERGED
  • To make the presentation of the list of barcode formats manageable we should sort the list of barcodes in the same/similar way as the web-based generator here. NOW MERGED
    • The list is still long and may be unworkable on certain platforms. Consider a multi-combo approach or other. NOW MERGED
  • Extract descriptions, example data and example options from the barcode.ps metadata by scanning for DESC, EXAM and EXOP stanzas within BEGIN/ENCODER ENCODER blocks. NOW MERGED
  • Use the BWIPP error reporting mechanism to provide specific error messages to users so that they can understand why a given input is invalid. NOW MERGED
  • Render the preview in a background QThread so that updating the preview image doesn't snatch attention away from the UI. See here. NOW MERGED
  • Allow the location of the barcode.ps file to be configured by the user so that non-admins users can provide a local version and distributions that deprecate bundled libraries can provide a separately packaged version. cbradney TO REVIEW.
  • Create a new type of Scribus Barcode Item:
    • A vector item that cannot be ungrouped
    • Initially fixed aspect ratio
    • Stores the value behind the created barcode: codeEdit, optionsEdit, lnColor, bgColor, txtColor (Checkbox states unnecessary as encoded in optionsEdit)
    • Ideally, double-clicking on such an item would bring up the barcode dialogue (not the Group Tab of the PP), so that a user can change the data, and the barcode drawing would be updated after clicking an "Update" button. This would, obviously, require some extensions to the Scribus core, as well as changes to the file format.
  • Allow the barcode plugin to be driven from ScripterNG.

Collaborative tasks

The following tasks require some degree of coordination between Scribus and Terry Burton, the author of BWIPP.

  • Extend the barcode.ps metadata to describe the options that are available for each encoder so that any frontends such as the Scribus plugin can be light on compiled in data and enhanced with new format by simply replacing the barcode.ps file. [IN PROGRESS UPSTREAM - https://github.com/bwipp/postscriptbarcode/tree/master/libs]