A
A
Andrey Golubkov2019-11-02 12:25:18
C++ / C#
Andrey Golubkov, 2019-11-02 12:25:18

Which parameter in PDF is responsible for indenting from the edge of the page?

Created two PDF files in Word.
In one PDF I set the left margin more, in the other - less.
When viewing, you can see that the fields are different, but how to find the sizes of the fields programmatically?
I'm trying to display the sizes of ArtBox, BleedBox, CropBox, MediaBox, TrimBox and Rect, but they are the same in both documents.
5dbd4b5c8fd0c692187814.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2019-11-02
@402d

I haven't found a way to determine the margins for two years, except to render to an image and search from each edge to the first non-white dot.

#
#, 2019-11-02
@mindtester

as of 11/02/2019 19:25 Moscow time we have
a question

Which parameter in PDF is responsible for indenting from the edge of the page?

explanation
Created two PDF files in Word.
In one PDF I set the left margin more, in the other - less.
When viewing, you can see that the fields are different, but how to find the sizes of the fields programmatically?
I'm trying to display the sizes of ArtBox, BleedBox, CropBox, MediaBox, TrimBox and Rect, but they are the same in both documents.

- C#mentioned only in the tag
- OpenXML SDKnot mentioned at all
- mentioned Created two PDF files in Word . with a creak, conjecturing the involvement in the issue of the tag C#, you can suggest creating your documents programmatically in the Word, editing the page parameters in the same place, and then saving to pdf. I think it should take much less than two years to study the task of managing page parameters in Word,
and save it in pdf
generally elementary
после того как нагуглишь, у меня ушло не более вечера.
задача была конвертировать rtf в pdf. если платные либы, но это запрещалось. все беплатное было через заднее крыльцо html, что попахивало жуткими потерями идентичности документов. при этом не запрещалось использовать word. вышло так
internal static bool wordAsConverter(string rtf, string pdf, bool verb = true, bool clean = true)
{
  $"\t..try convert to pdf...".print();
  var res = false;
  var app = new Application();
  try
  {
    var doc = app.Documents.Open(rtf);
    doc.ExportAsFixedFormat(pdf, WdExportFormat.wdExportFormatPDF);
    doc.Close(false);
    res = true;
    var fn = Path.GetFileName(rtf);
    if (verb) $"\t{fn} converted to pdf".print();
    if (clean)
    {
      File.Delete(rtf);
      if (verb) $"\t{fn} deleted".print();
    }
  }
  catch (Exception e) { e.Message.print(); }
  finally { app.Quit(false); }
  return res;
}
// что бы не смущал .print(); это уже привычка, для уменьшения многословности кода
internal static void print(this string s) => Console.WriteLine(s);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question