Safe Haskell | None |
---|
A Pdf rendering backend for diagrams.
To build diagrams for Pdf rendering use the Pdf
type in the diagram type construction
d :: Diagram Pdf R2 d = ...
and render giving the Pdf
token
renderDia Pdf (PdfOptions (Width 400)) d
This IO action will write the specified file.
Specific HPDF primitives
For details about the use of the HPDF specific primitives, the file test.hs in this package can be used. You'll have to unpack the archive for this package.
- data Pdf = Pdf
- data family Options b1 v1
- sizeFromSpec :: SizeSpec2D -> (Double, Double)
- data LabelStyle = LabelStyle FontName LabelSize Justification TextOrigin (Colour Double)
- data TextOrigin
- = Center
- | LeftSide
- | RightSide
- | TopSide
- | BottomSide
- | TopLeftCorner
- | TopRightCorner
- | BottomLeftCorner
- | BottomRightCorner
- type LabelSize = Int
- pdfLabelWithSuggestedSize :: (Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) => LabelStyle -> String -> Double -> Double -> (Diagram Pdf R2, Diagram Pdf R2)
- pdfTextWithSuggestedSize :: (ParagraphStyle ps s, Style s, Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) => TextOrigin -> Double -> Double -> ps -> s -> TM ps s () -> (Diagram Pdf R2, Diagram Pdf R2)
- pdfLabelWithSize :: (Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) => LabelStyle -> String -> Double -> Double -> Diagram Pdf R2
- pdfTextWithSize :: (ParagraphStyle ps s, Style s, Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) => TextOrigin -> Double -> Double -> ps -> s -> TM ps s () -> Diagram Pdf R2
- pdfImage :: (Monad m, PDFGlobals m) => PDFReference PDFJpeg -> m (Diagram Pdf R2)
- pdfURL :: String -> Double -> Double -> Diagram Pdf R2
- pdfAxialShading :: HasStyle a => P2 -> P2 -> Colour Double -> Colour Double -> a -> a
- pdfRadialShading :: HasStyle a => P2 -> Double -> P2 -> Double -> Colour Double -> Colour Double -> a -> a
PDF Backend
Backend token
This data declaration is simply used as a token to distinguish this rendering engine.
Backend options
data family Options b1 v1
Backend-specific rendering options.
sizeFromSpec :: SizeSpec2D -> (Double, Double)Source
HPDF Specific primitives
Text
data LabelStyle Source
Style for a label. It is not considered as an attribute but as a different primitive because internaly it is a complex text which can support several styles in the same paragraph. Label is just a convenience wrapper when the full features are not needed
data TextOrigin Source
pdfLabelWithSuggestedSizeSource
:: (Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) | |
=> LabelStyle | Style of the label |
-> String | String to display with this style |
-> Double | Suggested width |
-> Double | Suggested height |
-> (Diagram Pdf R2, Diagram Pdf R2) | Text and bounding rect of the typeset text |
Typeset a text with a given style in a suggested box. The function is returning a diagram for the text and a diagram for the bounding box which may be smaller than the suggested size : smaller width when the algorithm has done some line justification. The text may also be bigger than the suggested width in case of overflow (similar to the way TeX is doing thing. There are settings in HPDF to control the elegance of the line cuts but those settings are not accessible from this simple API). The text will not be longer than the suggested height. In that case the additional text is not displayed except perhaps partially the last line since no clipping is done.
pdfTextWithSuggestedSizeSource
:: (ParagraphStyle ps s, Style s, Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) | |
=> TextOrigin | Text origin |
-> Double | Suggested width |
-> Double | Suggested height |
-> ps | Paragraph (vertical) style |
-> s | Horizontal style |
-> TM ps s () | Text |
-> (Diagram Pdf R2, Diagram Pdf R2) | Text and bounding rect of the typeset text |
Similar to the pdfLabelWithSuggestedSize
but supporting the full features of HPDF
:: (Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) | |
=> LabelStyle | Style of the label |
-> String | String to display with this style |
-> Double | Suggested width |
-> Double | Suggested height |
-> Diagram Pdf R2 | Text |
Similar to the pdfLabelWithSuggestedSize
but here the size is forced and even
if the bounding box of the text is smaller it will not be taken into account
for the diagram envelope.
:: (ParagraphStyle ps s, Style s, Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) | |
=> TextOrigin | Text origin |
-> Double | Suggested width |
-> Double | Suggested height |
-> ps | Paragraph (vertical) style |
-> s | Horizontal style |
-> TM ps s () | Text |
-> Diagram Pdf R2 | Text |
Similar to pdfTextWithSuggestedSize
but the size if forced and not just suggested
Image
:: (Monad m, PDFGlobals m) | |
=> PDFReference PDFJpeg | Reference to the Jpeg image in the PDF resources |
-> m (Diagram Pdf R2) |
Create an image diagram
URL
:: String | URL (in a next version it should be URI) |
-> Double | Width of active area |
-> Double | Height of active area |
-> Diagram Pdf R2 |
Create an URL diagram