edeposit.amqp.pdfgen¶
This module is used to dynamically generate some of the PDF documents, which are required by the E-deposit project website.
API¶
pdfgen package¶
Submodules¶
pdfgen.specialization module¶
- pdfgen.specialization.get_contract(firma, pravni_forma, sidlo, ic, dic, zastoupen)[source]¶
Compose contract and create PDF.
Parameters: Returns: StringIO file instance containing PDF file.
Return type: obj
- pdfgen.specialization.get_review(review_struct)[source]¶
Generate review from review_struct.
Parameters: review_struct (obj) – GenerateReview instance. Returns: StringIO file instance containing PDF file. Return type: obj
pdfgen.translator module¶
- pdfgen.translator.FOOTER = '###Page###/###Total###'¶
Module contents¶
- pdfgen.reactToAMQPMessage(message, sender)[source]¶
React to given (AMQP) message. message is usually expected to be collections.namedtuple() structure filled with all necessary data.
Parameters: - message (*Request class) – One of the structures defined in requests.
- sender (fn reference) – Reference to function for responding - progress monitoring for example. Function takes one parameter, which may be response namedtuple, or string or whatever would be normally returned.
Returns: One of the responses in responses.
Return type: obj
Raises: ValueError – if bad type of message structure is given.
pdfgen.specialization module¶
- pdfgen.specialization.get_contract(firma, pravni_forma, sidlo, ic, dic, zastoupen)[source]¶
Compose contract and create PDF.
Parameters: Returns: StringIO file instance containing PDF file.
Return type: obj
- pdfgen.specialization.get_review(review_struct)[source]¶
Generate review from review_struct.
Parameters: review_struct (obj) – GenerateReview instance. Returns: StringIO file instance containing PDF file. Return type: obj
pdfgen.translator module¶
- pdfgen.translator.FOOTER = '###Page###/###Total###'¶
AMQP communication¶
pdfgen.structures.requests module¶
- class pdfgen.structures.requests.GenerateContract[source]¶
Bases: pdfgen.structures.requests.GenerateContract
Request to generate contract.
- firma¶
str – As it is defined in contract.
- pravni_forma¶
str – As it is defined in contract.
- sidlo¶
str – As it is defined in contract.
- ic¶
str – As it is defined in contract.
- dic¶
str – As it is defined in contract.
- zastoupen¶
str – As it is defined in contract.
- class pdfgen.structures.requests.GenerateReview[source]¶
Bases: pdfgen.structures.requests.GenerateReview
Generate review of sent form.
- nazev¶
any – Název ePublikace
- podnazev¶
any – Podnázev
- cast¶
any – Část (svazek,díl)
- nazev_casti¶
any – Název části, dílu
- isbn¶
any – ISBN
- isbn_souboru_publikaci¶
any – ISBN souboru
- generated_isbn¶
any – Přidělit ISBN
any – Autor
any – Autor 2
any – Autor 3
- poradi_vydani¶
any – Pořadí vydání, verze
- misto_vydani¶
any – Místo vydání
- rok_vydani¶
any – Rok vydání
- nakladatel_vydavatel¶
any – Nakladatel
- vydano_v_koedici_s¶
any – Vydáno v koedici s
- cena¶
any – Cena v Kč
- anotace¶
any – Anotace knihy
- libraries_accessing¶
any – Oprávnění knihovnám
- libraries_that_can_access¶
any – Seznam knihoven
- is_public¶
any – Vystavení na volném internetu
- url¶
any – URL
- offer_to_riv¶
any – Zpřístupnit pro RIV
- category_for_riv¶
any – Seznam oborů pro RIV
- zpracovatel_zaznamu¶
any – Zpracovatel záznamu
- format¶
any – Formát souboru
- filename¶
any – Název souboru
- internal_url¶
any – Edeposit URL
- class pdfgen.structures.requests.RST2PDF[source]¶
Bases: pdfgen.structures.requests.RST2PDF
Generic request to convert RST file to PDF.
- rst_content¶
str – Content of the generated PDF file.
- style¶
str – Style for the generated PDF file.
- header¶
str, default None – Header of each page.
str, default pagecount – Footer of each page.
pdfgen.structures.responses module¶
- pdfgen.structures.responses.pdf_from_file(file_obj)[source]¶
Convert file_obj to base64 string.
Parameters: file_obj (obj) – Opened file like object. Returns: Base64 encoded string. Return type: str
- class pdfgen.structures.responses.PDF[source]¶
Bases: pdfgen.structures.responses.PDF
Response to request containing base64 representation of genrated PDF.
- b64_content¶
str – Base64 string.
Installation¶
Installation at debian systems is really easy:
pip install edeposit.amqp.pdfgen
(Open)Suse¶
OpenSuse by default doesn’t have installed the FreeSerif fonts, which are required for this package.
You can install it using following commands:
cd /tmp
wget http://213.174.32.130/sles/distribution/11.0-SP1/repo/sdk/suse/noarch/freefont-0.20080323-1.17.noarch.rpm
zypper install freefont-0.20080323-1.17.noarch.rpm
Source code¶
This project is released as opensource (GPL) and source codes can be found at GitHub: