From wiki.ginstr.com
Jump to: navigation, search

gn:act_convertHtmlToPdf

Description
Action used to convert html to pdf document. If html contains pictures they will also be included into document. Please note that action is asynchronous and that execution of all code after the action will continue immediately and likely before this action completes. In order to execute logic after this action as completed actions must be set into action set gn:act_onConverHtmlToPdfComplete
Action returns
void

Action signatures

[gn:act_convertHtmlToPdf]|[source, target, orientation, attachments]
Parameter Description
source source at which html is stored
target target to which pdf document will be stored
orientation orientation of pdf document, possible values : portrait, landscape
attachments target target at which images are stored that will be saved to pdf
gn:act_onConverHtmlToPdfComplete action set at which logic execution follows after PDF creation

Example

variables.xml
<variable id="emailBody" type="text"></variable>
<variable id="pdfDocument" type="documents"/>
<variable id="photosDelivery" type="pictures"/>
screen.xml
<FrameLayout
    android:id="@+id/exampleFrame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    gn:act_onConverHtmlToPdfComplete="[gn:act_toast]|[@string/pdfCreationCompleteSavingRecord]"
    gn:act_set="[gn:act_convertHtmlToPdf]|[@variable/emailBody,@variable/pdfDocument,landscape,@variable/photosDelivery(id)]" />
after action execution

once gn:act_convertHtmlToPdf is executed pdf document will be stored into @variable/pdfDocument. Since this is asynchronous action execution must be continued at gn:act_onConverHtmlToPdfComplete where further operations with pdf document can be done