Tekninen artikkeli

PDF-tiedostojen luominen tyhjästä (Creating PDFs from Scratch with PDFium Component in Delphi) Delphissä PDFium Component -komponentilla

PDFiumilla on (PDFium has a) maine katselumoottorina (reputation as a viewer engine, the), hahmontajana Chromen (renderer behind Chrome's) PDF-välilehden (PDF tab, so) takana (behind Chrome's PDF tab, so), joten (so the first) ensimmäinen selvennettävä (thing to clear up) asia (is that) on, että PDFium Component (PDFium Component can) voi myös (also build a) rakentaa (build a document that) asiakirjan (document that never), jota (never existed before. The) ei koskaan aiemmin (never existed before. The) ollut olemassa (existed before. The). Luontipuoli käärii sisäänsä (authoring side wraps PDFium's) PDFiumin sivuobjekti-API:n: (page-object API: you) teet tyhjän asiakirjan (make an empty document, add), lisäät sivuja nimenomaisilla (pages with explicit) mitoilla, ja (dimensions, and drop) pudotat tekstin (text, vector paths), vektoripolut ja (and images onto) kuvat jokaiselle (each page at) sivulle (page at coordinates) valitsemiisi koordinaatteihin (you choose. There). Opittavana ei (is no page) ole sivunkuvauskieltä (description language to) eikä tulostinohjainta ole silmukassa (print driver in the loop. You). Kutsut (You call methods, the) metodeja, kirjasto (library assembles PDF) kokoaa (assembles PDF objects, and) PDF-objektit, ja (objects, and SaveAs) SaveAs-kutsu (SaveAs serializes the) sarjallistaa (serializes the result) tuloksen (result)

Mitä (What you do) et (not get is) saa, on (is a layout) asettelumoottori (layout engine. This). Tällä on (This matters enough) tarpeeksi (enough to say) väliä, jotta se (say up front, because) voidaan sanoa suoraan (up front, because it), koska se (it shapes every) muokkaa jokaista alla olevaa esimerkkiä (example below. PDFium). PDFium Component sijoittaa (places content where) sisällön sinne (content where you), minne käsket sen sijoittaa (tell it to, in), absoluuttisiin (absolute coordinates, and) koordinaatteihin, eikä (and nowhere else. It) minnekään muualle (nowhere else. It). Se ei (will not wrap) rivitä kappaletta (wrap a paragraph, flow), juoksuta tekstiä (flow text across) sivunvaihdon (across a page break, or) yli (a page break, or) tai (or compute a) laske taulukkoa rivien ja (table from rows and) sarakkeiden perusteella (columns. Those). Ne (Those are your) ovat (are your job. If) sinun (your job. If) tehtäväsi (job. If you). Jos (If you arrived) saavuit (arrived expecting something) odottaen (expecting something that) jotain (something that reflows), mikä juoksuttaa suorasanaisen tekstin uudelleen (reflows prose the) kuten (the way a) tekstinkäsittelyohjelma (word processor does, calibrate) tekee, kalibroi (does, calibrate now: this) itsesi (now: this is) nyt: tämä (this is a) on tarkka (precise, low-level), matalan (low-level placement API, closer) tason (placement API, closer to) sijoittelu-API, (to drawing on) lähempänä kankaalle (drawing on a) piirtämistä (canvas than typesetting) kuin (than typesetting a) asiakirjan latomista (document. For). Luoduille (For generated invoices, certificates) laskuille, todistuksille (certificates, labels, and), tarroille ja raporttisivuille (report pages where), joissa tiedät jo (you already know), mihin jokainen (where every element) elementti kuuluu (belongs, that), tuo (that precision is) tarkkuus (precision is exactly) on (is exactly what) juuri (exactly what you) sitä, mitä haluat (you want)

Minimi, joka (The minimum that) tuottaa tiedoston (produces a file)

Kolme (Three calls stand) kutsua (calls stand between) seisoo tyhjän (between an empty) TPdf-objektin (TPdf and a) ja tallennetun (and a saved) PDF:n välillä: (PDF: create the) luo asiakirja (document, add a), lisää (add a page, write) sivu, kirjoita se (it out. Everything) ulos. Kaikki muu (Everything else is) on sisältöä, jota (content you layer) kerrostat siihen (layer in between) väliin

uses
  Vcl.Graphics,   // for clBlack and TColor
  PDFium;         // TPdf lives here

procedure CreateBlankPdf(const FileName: string);
var
  Pdf: TPdf;
begin
  Pdf := TPdf.Create(nil);
  try
    Pdf.CreateDocument;                 // empty in-memory document
    Pdf.AddPage(0, 595, 842);           // A4 portrait, in points
    Pdf.AddText('First page', 'Arial', 18, 50, 780);
    Pdf.SaveAs(FileName);               // serialize to disk
  finally
    Pdf.Active := False;
    Pdf.Free;
  end;
end;

Yksi yksityiskohta saa (One detail trips) kompastumaan ne (people who have), jotka ovat (have seen older) nähneet vanhempia katkelmia (snippets: you): et (you do not) sijoita arvoa Pdf.Active := True (Pdf.Active := True after) sen (after CreateDocument. The) jälkeen, kun (CreateDocument. The Active) CreateDocument-kutsu (CreateDocument. The Active property) on tehty. Active-ominaisuus kertoo (reports whether a), onko (whether a document) asiakirjakahva olemassa (document handle exists, and), ja (and CreateDocument has) CreateDocument on jo luonut (already created one, so) sellaisen, joten (so the property) ominaisuus (property is True) on (is True the) tosi sillä hetkellä (moment that call) kun kutsu (call returns. Setting) palauttaa arvon (returns. Setting it). Sen asettaminen (Setting it again) uudelleen (again is a) on (is a no-op) parhaimmillaan (at best and) nollatoiminto (no-op at) ja pahimmillaan harhaanjohtavaa (misleading to the) seuraavalle (next reader at) lukijalle (reader at worst. Active). Active ansaitsee paikkansa (earns its keep) poistuttaessa: (on the way) arvon False asettaminen vapauttaa (out: assigning False releases) alla (underlying document before) olevan asiakirjan ennen Free-kutsua, mikä (Free, which is) on puhdas purkamisjärjestys (clean teardown order. Treat). Käsittele (Treat CreateDocument and) CreateDocument-kutsua ja (CreateDocument and a) tiedostonlataus-avaamista (file-loading open as) toisensa poissulkevina (mutually exclusive. The). Kirjasto kieltäytyy (library refuses to) luomasta (create a new) uutta (new document on) asiakirjaa (document on a) TPdf-objektiin, jolla on jo yksi (already has one) avattuna, joten uudelleenkäyttö (open, so reuse) tarkoittaa nykyisen (means closing the) asiakirjan (current document first) sulkemista (closing the current) ensin (first)

Koordinaatit alkavat alhaalta (Coordinates start at the bottom-left) vasemmalta (left)

Toinen (second argument pair) argumenttipari AddText-kutsulle (AddText, and to) ja (and to every) jokaiselle sijoittelukutsulle (placement call, is) on (is a point) piste (point in PDF) PDF:n käyttäjätilassa (user space. The). Origo (origin sits at) sijaitsee (sits at the) sivun vasemmassa alakulmassa (lower-left corner of), X juoksee oikealle (runs right, and), ja Y juoksee (runs *up*. One) ylös. Yksi (One unit is) yksikkö on yksi (one point, 1/72) piste, 1/72 tuumaa (of an inch), joten (so an A4) A4-sivu on 595 kertaa 842 yksikköä (page is 595) ja (by 842 units) US (and US Letter) Letter on 612 kertaa (is 612 by) 792. Tuo ylöspäin (792. That upward) suuntautuva (upward Y is) Y (is the single) on (is the single most) ylivoimaisesti yleisin "tekstini on (common source of) poissa sivulta" (my text is) -hämmennyksen (off the page" confusion, because) lähde, koska (confusion, because screen) näytön ja (and bitmap coordinates) bittikartan (bitmap coordinates put) koordinaatit (put the origin) asettavat (put the origin at) origon ylös, ja Y kasvaa alaspäin (top with Y). 842 pistettä (growing downward. On) korkealla (an 842-point-tall page, a) sivulla yläreunan lähellä (heading near the) oleva (top sits around) otsikko istuu suunnilleen arvon (Y 780, not) Y 780, ei (not Y 60. When) Y 60, kohdalla. Kun suoritus päätyy johonkin odottamattomaan (a run lands), sivun (somewhere unexpected, the) korkeus miinus Y-arvosi on lähes aina luku, jota todella tarkoitit (page height minus your Y is almost always the number you actually meant)

AddPage (AddPage takes an) ottaa (takes an insertion) lisäyskohdan (insertion position as) ensimmäisenä argumenttinaan (first argument, expressed), yksi-pohjaisesti (one-based, with) ilmaistuna, missä 0 on kätevä (0 as a) "asiakirjan alku" (start of document" shorthand) -lyhennys. Välitä (shorthand. Pass 0) 0 tai 1 ensimmäiselle sivulle (or 1 for), ja (first page and) sivu lisätään (page is inserted) alkuun; välitä lukumäärää, johon liität (value matching the), vastaava (count you are) arvo (appending to in) lisätäksesi loppuun (order to add). Äskettäin lisätystä (at the end. The) sivusta tulee myös nykyinen (newly added page), se, johon myöhemmät piirtokutsut (also becomes the) kohdistuvat (current page, the), joten sen lisäämisen (one subsequent drawing) jälkeen (calls target, so) ei (there is no) ole (is no separate) erillistä (separate "select this) "valitse (select this page" step) tämä sivu" -vaihetta (step after adding). Jos lisäät useita sivuja ja (it. If you) sinun (add several pages) täytyy (and later need) myöhemmin (to draw back) piirtää takaisin (onto an earlier) aiemmalle, aseta PageNumber (one, set PageNumber) siirtääksesi kursoria (to move the); kun (cursor; while you) täytät sivuja järjestyksessä (are filling pages) sitä mukaa kun luot (in order as) niitä, voit jättää sen rauhaan (you create them, you can leave it alone)

Tekstin (Writing text, and) kirjoittaminen (Writing text, and) ja (and the font) fonttisääntö (font rule that), joka (rule that bites) puree hiljaa (silently)

AddText-allekirjoitus kantaa kaikkea, mitä (signature carries everything) yksittäinen (a single run) veto tarvitsee (needs: the string): merkkijonon, fontin nimen (font name, a), koon pisteinä (size in points), X- ja (the X and) Y-ankkurin, sitten (Y anchor, then) valinnaisen (optional color, an) värin (color, an alpha), alphatavun läpinäkyvyyttä (byte for transparency) varten ja (and a rotation) kiertokulman (angle in degrees) asteina

procedure WriteHeader(Pdf: TPdf; const Title, Author: string);
begin
  // Title in black, default opacity, no rotation
  Pdf.AddText(Title, 'Arial', 20, 50, 780);
  // A lighter byline 24 points below it
  Pdf.AddText('By ' + Author, 'Arial', 11, 50, 756, clGray);
  // A faint diagonal draft stamp across the page
  Pdf.AddText('DRAFT', 'Arial', 64, 180, 380, clGray, $30, 45.0);
end;

Alphatavu (alpha byte runs) kulkee arvosta $00 (näkymätön (invisible) to $FF) arvoon $FF (läpinäkymätön), mikä (opaque), which is) tekee (what makes the) luonnoksen (draft stamp a) leimasta (watermark rather than) vesileiman (watermark rather than) pikemminkin (a solid block: $30) kuin yhtenäisen lohkon: (is roughly nineteen) $30 on karkeasti (percent opacity, enough) yhdeksäntoista (opacity, enough to) prosentin läpinäkyvyys, tarpeeksi jotta sen (read through. The) läpi voi lukea (read through. The). Kulma kiertää (angle rotates the) vetoa vastapäivään ankkurinsa ympäri, joten (run counterclockwise around) 45 astetta (its anchor, so) antaa klassisen (45 degrees gives) kulmasta kulmaan (the classic corner-to-corner) leiman. Mikään tästä (stamp. None of) ei (this needs a) vaadi erillistä (separate watermark feature. A) vesileimaominaisuutta (watermark feature. A watermark). Vesileima on (watermark is just) vain (a large, semi-transparent) suuri (large, semi-transparent, rotated), puoliksi läpinäkyvä (semi-transparent, rotated AddText), kierretty (rotated AddText call) AddText-kutsu (AddText call, and), ja sen (and drawing it) piirtäminen ennen (before or after) runkoa tai sen (the body decides) jälkeen päättää (whether it sits), istuuko se sisällön takana (behind or on) vai (on top of) päällä

Fontit ansaitsevat huolellisen lauseen (deserve a careful), koska (sentence, because the) vikatila on hiljainen (failure mode is). Kun (quiet. When you) välität fontin (pass a font) nimen, PDFium Component kysyy käyttöjärjestelmältä (name, PDFium Component asks the operating system for) kyseisen (that font's TrueType) fontin TrueType-tietoja ja upottaa (data and embeds) ne (it in the) asiakirjaan, minkä vuoksi (document, which is) koneellasi rakennettu (why a file) tiedosto hahmonnetaan (built on your) identtisesti koneella (machine renders identically), johon (on one that) kyseistä (has never had) fonttia (the font installed. The) ei koskaan (never had the) ole asennettu. Juju on siinä (catch is what), mitä tapahtuu (happens when the), kun (when the name) nimi ei (does not resolve: a) ratkea: kyseessä voi olla lyöntivirhe tai (typo, or a) kirjasin, jota ei yksinkertaisesti ole (face that simply) koontikoneella (is not present). Poikkeusta (on the build) ei ole (machine. There is). Kirjasto (no exception. The) turvautuu (library falls back) tekstiobjektin (to creating a) luomiseen (text object that), joka kantaa (carries the name) nimeä vain otsikkona, upottamatta mitään (as a label), ja (only, with nothing) jättää (embedded, and leaves) katseluohjelman (the viewer to) korvaamaan sen (substitute whatever it) millä (considers close. The) tahansa, mitä se (what it considers) pitää läheisenä. Teksti (close. The text) näkyy (appears in your) testeissäsi (tests, looks plausible), näyttää uskottavalta (looks plausible, and), ja muuttaa mittoja tai glyyfejä sillä (and shifts metrics) hetkellä (or glyphs the), kun (moment the file) tiedosto avataan (opens somewhere with) jossakin, jossa on asennettu eri fontit (different fonts installed. Use). Käytä nimiä, joiden (Use names you) tiedät (know are present) olevan luovalla (on the generating) koneella (machine, treat the), käsittele fonttiluetteloa (font list as) käyttöönottoriippuvuutena (a deployment dependency, and) ja avaa (open a sample) näyte (in a viewer) katseluohjelmassa (on a clean) puhtaalla järjestelmällä (system before you) ennen kuin luotat (trust the output) tulosteeseen (output)

Vektorimuodot: rakenna (Vector shapes: build) polku (a path, then) ja ota se sitten (commit it) käyttöön (commit it)

Viivat, suorakulmiot ja (Lines, rectangles, and) täytetyt alueet (filled regions go) menevät (through a path. You) polun kautta. Avaat (open one with) sellaisen CreatePath-kutsulla, joka (CreatePath, which sets) asettaa aloituspisteen ja kaikki (the start point) tyylit (and all the) kerralla: (styling at once), täyttötilan, täyttö- ja (fill mode, fill) viivavärit omilla alphatavuillaan (and stroke colors), viivan (with their own) leveyden (alpha bytes, stroke), viivan päät ja (width, line caps) liitokset (and joins. Then). Sitten laajennat (Then you extend) sitä LineTo-, (it with LineTo) BezierTo- ja (BezierTo, and ClosePath) ClosePath-kutsuilla, ja (and finally AddPath) lopuksi (finally AddPath commits) AddPath kiinnittää (commits the finished) valmiin (finished path onto) polun sivulle (the page. The). Kiinnitysvaihe (commit step is) on (easy to forget) helppo unohtaa (forget and produces), ja se (produces nothing if) ei tuota mitään (you skip it), jos ohitat (skip it) sen

procedure DrawDivider(Pdf: TPdf; X, Y, Width: Single);
begin
  // A thin horizontal rule. The rectangle overload sets a box directly:
  // X, Y, Width, Height, then fill mode and colors.
  Pdf.CreatePath(X, Y, Width, 0.5, fmNone, clBlack, $FF,
    True, clBlack, $FF, 1.0);
  Pdf.AddPath;
end;

procedure DrawTriangle(Pdf: TPdf);
begin
  // Point overload: start at the first vertex, line to the rest, close.
  Pdf.CreatePath(200, 300, fmWinding, clBlue, $80, True, clNavy, $FF, 2.0);
  Pdf.LineTo(300, 300);
  Pdf.LineTo(250, 400);
  Pdf.ClosePath;
  Pdf.AddPath;          // nothing is drawn until this runs
end;

Kaksi ylikuormitusta (Two overloads cover) kattaa yleiset (the common cases. The) tapaukset (cases. The four-coordinate). Nelikoordinaattinen muoto ottaa (form takes X) X:n (Y, width, and), Y:n (height and gives), leveyden (width, and height) ja (and gives you) korkeuden ja antaa sinulle akselin suuntaisen (an axis-aligned rectangle) suorakulmion (in one call, which) yhdellä kutsulla (is what you), mihin tartut (reach for to) piirtääksesi viivan (draw a rule, a), solun reunan (cell border, or) tai (or a filled) täytetyn taustapaneelin (background panel. The). Kaksikoordinaattinen muoto asettaa (two-coordinate form sets) vain (only a start) aloituspisteen, ja sinä jäljität loppuosan ääriviivasta (point, and you trace the rest of the outline yourself with) itse LineTo- ja (LineTo and BezierTo. Fill) BezierTo-kutsuilla (BezierTo. Fill mode). Täyttötila ohjaa päällekkäisten (mode controls how) alueiden maalausta (overlapping regions are): fmWinding (nollasta (nonzero winding) suits) poikkeava kierto (most solid shapes, fmAlternate) sopii (suits most solid) useimpiin yksivärisiin (shapes, fmAlternate (even-odd) muotoihin, fmAlternate (parillinen/pariton (even-odd) handles) käsittelee leikkauksia ja (cutouts and self-intersecting) itsensä (outlines, and fmNone) leikkaavia (self-intersecting outlines, and) ääriviivoja, ja (fmNone leaves a) fmNone jättää pelkällä viivalla piirretyn polun ilman täyttöä (stroked-only path with no fill, which is), jota edellä oleva jakaja käyttää (what the divider above uses)

Taulukot (Tables are paths) ovat (are paths and) polkuja (text, assembled by) ja tekstiä (hand), koottuna (assembled by hand) käsin (hand)

Koska taulukko-primitiiviä ei (Because there is no table primitive, a) ole, taulukko on (table is a) silmukka. Päätät (loop. You decide) sarakkeiden (the column X) X-poikkeamat ja rivin (offsets and the) korkeuden, kirjoitat (row height, write) jokaisen solun (each cell with) AddText-kutsulla ja (AddText, and draw) piirrät viivat (the rules with) suorakulmiopoluilla (rectangle paths. The). Aritmetiikka on sinun (arithmetic is yours, but), mutta se on yksinkertaista (it is plain, and), ja kerran (once written it) kirjoitettuna se yleistyy (generalizes to any) mille tahansa tarvitsemallesi ruudukolle (grid you need)

procedure DrawTable(Pdf: TPdf; Left, Top: Double);
const
  ColX: array[0..2] of Double = (0, 110, 210);  // column offsets
  RowH = 20;
var
  Y: Double;
  Row: Integer;
begin
  // Header row
  Pdf.AddText('Item', 'Arial', 10, Left + ColX[0], Top);
  Pdf.AddText('Qty', 'Arial', 10, Left + ColX[1], Top);
  Pdf.AddText('Price', 'Arial', 10, Left + ColX[2], Top);

  // Rule under the header
  Pdf.CreatePath(Left, Top - 5, 260, 0.5, fmNone, clBlack, $FF);
  Pdf.AddPath;

  // Data rows, stepping Y downward each iteration
  Y := Top;
  for Row := 1 to 3 do
  begin
    Y := Y - RowH;
    Pdf.AddText('Item ' + IntToStr(Row), 'Arial', 9, Left + ColX[0], Y);
    Pdf.AddText(IntToStr(Row * 2), 'Arial', 9, Left + ColX[1], Y);
    Pdf.AddText('$' + IntToStr(Row * 10) + '.00', 'Arial', 9, Left + ColX[2], Y);
  end;
end;

Huomaa Y:n astuminen alaspäin (Notice the Y stepping downward by the) rivikorkeuden verran joka kerta, jälleen koska ylös on positiivinen (row height each pass, again because up is positive. This). Tässä näkyy myös (is also where) tekstinmittauksen puuttuminen (the absence of): mikään ei estä pitkää kohteen nimeä (text measurement shows: nothing stops a long item name from) valumasta (overrunning into the) seuraavaan sarakkeeseen, koska (next column, because) kirjasto ei tiedä (the library does), kuinka leveäksi merkkijonosi (not know how) hahmonnettiin (wide your string rendered. For). Kiinteämuotoiselle tulosteelle, jossa (fixed-format output where) ohjaat (you control the) dataa, mitoitat (data, you size) sarakkeet (columns generously and) reilusti (generously and move) ja jatkat matkaa (move on. For). Aidosti (genuinely variable content) muuttuvalle sisällölle (content, you either) joko rajoitat (constrain inputs or) syötteitä tai mittaat glyyfien leveydet (measure glyph widths) itse ennen (yourself before placing) niiden sijoittamista, mikä on (them, which is) se (the point at) piste (which a dedicated), jossa omistettu kompositio-kirjasto alkaa (composition library starts to) maksaa itseään takaisin (pay for itself)

Kuvat ja useat (Images and multiple) sivut (pages)

Rasterisisältö tulee sisään kuva-apulaisten (Raster content comes) kautta. AddPicture (in through the) ottaa (image helpers. AddPicture takes a) ladatun TPicture-objektin ja (loaded TPicture and) sijoittaa sen (places it at) pisteeseen, jossa on (a point, with) valinnainen leveys ja (an optional width) korkeus sen (and height to) skaalaamiseksi (scale it; AddImage); AddImage hyväksyy (accepts a file) tiedostopolun (path or a) tai suoraan (TBitmap directly, and) TBitmap-objektin (and AddJpegImage streams), ja (and AddJpegImage streams JPEG) AddJpegImage (AddJpegImage streams JPEG bytes) virtaa JPEG-tavuja (JPEG bytes without) ilman edestakaista matkaa bittikartan kautta (a round trip). Kuten (through a bitmap) kaiken muunkin kohdalla (As with everything), sijoittelukoordinaatit (else, the placement) ovat (coordinates are the) kuvan (lower-left corner of) vasen (the image in) alakulma (corner of the image in user) käyttäjätilassa, ja (space, and the) leveys (width and height) ja (are the on-page) korkeus ovat (size in points) sivulla (not the pixel) oleva (dimensions of the) koko pisteinä, eivät lähteen pikselimitat (source)

procedure CreateMultiPageReport(const FileName: string; PageCount: Integer);
var
  Pdf: TPdf;
  P: Integer;
begin
  Pdf := TPdf.Create(nil);
  try
    Pdf.CreateDocument;
    for P := 1 to PageCount do
    begin
      Pdf.AddPage(P, 595, 842);     // append; the new page becomes current
      Pdf.AddText('Page ' + IntToStr(P) + ' of ' + IntToStr(PageCount),
        'Arial', 10, 50, 30);       // footer near the bottom edge
      // ... draw this page's body here ...
    end;
    Pdf.SaveAs(FileName);
  finally
    Pdf.Active := False;
    Pdf.Free;
  end;
end;

Monisivuinen (multi-page document is) asiakirja on (the single-page pattern) yksisivuinen kuvio (in a loop) silmukassa. Jokainen (Each AddPage appends) AddPage liittää (a page and) sivun (makes it current) ja tekee (so the body) siitä (and footer you) nykyisen, joten runko (draw next land) ja (on the page) alatunniste (you just added), jotka (You do not) piirrät seuraavaksi (reassign PageNumber inside), laskeutuvat (this loop, because) juuri lisäämällesi (adding a page) sivulle. Et (already moved the) määritä (cursor there; you) PageNumber-ominaisuutta uudelleen (only need PageNumber) tämän (when you go) silmukan sisällä (back to a), koska sivun (page out of) lisääminen siirsi osoittimen (creation order. Call) jo sinne (SaveAs once at); tarvitset PageNumber-ominaisuutta vain silloin (the end, after), kun (after the last) palaat sivulle luomisjärjestyksen ulkopuolella (page is filled). Kutsu (If you need) SaveAs-metodia kerran lopussa, kun (an archival profile) viimeinen (rather than a) sivu (plain file, the) on täytetty. Jos (same document object) tarvitset (exposes SaveAsPdfA and) arkistointiprofiilin etkä tavallista tiedostoa (the other conformance), sama (variants, so the) asiakirjaobjekti (choice of output) paljastaa (standard is a) SaveAsPdfA- (different save call) ja muut yhteensopivuusmuunnokset (not a different), joten (build path) tulostestandardin (output standard is a) valinta on (different save call, not a) eri tallennuskutsu, ei eri koontipolku (different build path)

Mihin tämä (Where this fits) sopii (fits)

Rehellinen (honest framing is) kehystys (that PDFium Component's) on, että PDFium Component -komponentin (authoring API is) luonti-API on luotettava, ohut (a faithful, thin) kerros PDFiumin sivuobjektimallin päällä (layer over PDFium's): todellinen (page-object model: real) asiakirjan (document creation, real) luominen (embedded fonts, real), todelliset upotetut (vector and raster) fontit (content, serialized to), todellinen vektori- ja rasterisisältö (a standards-conforming file), sarjallistettuna standardien mukaiseen (It is not) tiedostoon (and does not). Se ei (pretend to be) ole (a reflowing document), eikä (engine. The dividing) teeskentele olevansa (line is text), tekstiä uudelleen juoksuttava (layout. If your) asiakirjamoottori. Jakolinja on tekstin asettelu (output is templated). Jos tulosteesi on (invoices, certificates, labels) mallipohjainen, laskuja, todistuksia (dashboards rendered to), tarroja (a fixed grid), kojelautoja (the absolute-coordinate model) hahmonnettuna kiinteään ruudukkoon (is direct and), absoluuttisten (fast and the) koordinaattien malli on (code stays readable) suora ja (If your output) nopea, ja koodi pysyy (is long-form prose) luettavana. Jos tulosteesi (that must wrap) on pitkämuotoista proosaa (and paginate on), jonka (its own, you) täytyy (will be rebuilding) rivittyä ja (a layout engine) sivuttua (on top of) itsestään (these calls, and), rakennat asettelumoottoria (that is the) uudelleen (wrong tool for) näiden (the job. Knowing) kutsujen päälle, ja se on (which side of) väärä työkalu kyseiseen tehtävään (that line you). Sen tietäminen (are on is), kummalla (most of the) puolella tuota (decision) linjaa olet, muodostaa suurimman osan (most of the decision) päätöksestä (decision)

Tässä kuvatut (creation methods described) luontimetodit (here are part) ovat osa (of the PDFium) PDFium Component -komponenttia (Component for Delphi) Delphi-ohjelmointikieleen (which pairs this), joka yhdistää (authoring path with) tämän luontipolun hahmonnus- (the rendering and) ja (and text-extraction features) tekstinpurkuominaisuuksiin, joista (PDFium is better) PDFium tunnetaan paremmin (known for)