IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques tierces Python Discussion :

Creation d'un PDF avec ReportLab


Sujet :

Bibliothèques tierces Python

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé Avatar de dedalios
    Homme Profil pro
    concepteur d'application
    Inscrit en
    Février 2008
    Messages
    495
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : concepteur d'application
    Secteur : Santé

    Informations forums :
    Inscription : Février 2008
    Messages : 495
    Par défaut Creation d'un PDF avec ReportLab
    Bonjour ,

    Je cherche une solution pour me permettre de créer des tableau en PDF:

    je suis partie vers la puissante solution :ReportLab

    Une idée de solution était de créer le tableau en html en de trouver un solution de conversion

    Une piste de solution pdfkit + wkhtmltopdf de https://wkhtmltopdf.org/downloads.html mais cette solution me déplais , car impossible d’installer le logiciel wkhtmltopdf version windows sur l'environnement windows

    Donc si vous avez quelque idee je suis preneur.

    il faut pouvoir construire des tableaux de taille divers.

    J'ai les données de chaque ligne d'un tableau et son titre .

    Il y n'a pas qu'un seul tableau d’où ma recherche de trouver une solution de construction automatique d'un tableau.


    Mais je n'ai rien trouve d'utilisable sur le web..

  2. #2
    Membre Expert

    Homme Profil pro
    Ingénieur calcul scientifique
    Inscrit en
    Mars 2013
    Messages
    1 229
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Ingénieur calcul scientifique

    Informations forums :
    Inscription : Mars 2013
    Messages : 1 229
    Par défaut
    Avec matplotlib, tu disposes de :

    - plt.table
    https://matplotlib.org/examples/pyla...able_demo.html
    https://stackoverflow.com/questions/...lib-table-only

    - plt.savefig("toto.pdf")

  3. #3
    Membre éclairé Avatar de dedalios
    Homme Profil pro
    concepteur d'application
    Inscrit en
    Février 2008
    Messages
    495
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : concepteur d'application
    Secteur : Santé

    Informations forums :
    Inscription : Février 2008
    Messages : 495
    Par défaut Interessant mais.......
    Citation Envoyé par lg_53 Voir le message
    Avec matplotlib, tu disposes de :

    - plt.table
    https://matplotlib.org/examples/pyla...able_demo.html

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
     
    # Copyright (c) 2010-2017 Benjamin Peterson
    #
    # Permission is hereby granted, free of charge, to any person obtaining a copy
    # of this software and associated documentation files (the "Software"), to deal
    # in the Software without restriction, including without limitation the rights
    # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    # copies of the Software, and to permit persons to whom the Software is
    # furnished to do so, subject to the following conditions:
    #
    # The above copyright notice and this permission notice shall be included in all
    # copies or substantial portions of the Software.
    #
    # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    # SOFTWARE.
     
    """Utilities for writing code that runs on Python 2 and 3"""
     
    from __future__ import absolute_import
     
    import functools
    import itertools
    import operator
    import sys
    import types
     
    __author__ = "Benjamin Peterson <benjamin@python.org>"
    __version__ = "1.11.0"
     
     
    # Useful for very coarse version differentiation.
    PY2 = sys.version_info[0] == 2
    PY3 = sys.version_info[0] == 3
    PY34 = sys.version_info[0:2] >= (3, 4)
     
    if PY3:
        string_types = str,
        integer_types = int,
        class_types = type,
        text_type = str
        binary_type = bytes
     
        MAXSIZE = sys.maxsize
    else:
        string_types = basestring,
        integer_types = (int, long)
        class_types = (type, types.ClassType)
        text_type = unicode
        binary_type = str
     
        if sys.platform.startswith("java"):
            # Jython always uses 32 bits.
            MAXSIZE = int((1 << 31) - 1)
        else:
            # It's possible to have sizeof(long) != sizeof(Py_ssize_t).
            class X(object):
     
                def __len__(self):
                    return 1 << 31
            try:
                len(X())
            except OverflowError:
                # 32-bit
                MAXSIZE = int((1 << 31) - 1)
            else:
                # 64-bit
                MAXSIZE = int((1 << 63) - 1)
            del X
     
     
    def _add_doc(func, doc):
        """Add documentation to a function."""
        func.__doc__ = doc
     
     
    def _import_module(name):
        """Import module, returning the module after the last dot."""
        __import__(name)
        return sys.modules[name]
     
     
    class _LazyDescr(object):
     
        def __init__(self, name):
            self.name = name
     
        def __get__(self, obj, tp):
            result = self._resolve()
            setattr(obj, self.name, result)  # Invokes __set__.
            try:
                # This is a bit ugly, but it avoids running this again by
                # removing this descriptor.
                delattr(obj.__class__, self.name)
            except AttributeError:
                pass
            return result
     
     
    class MovedModule(_LazyDescr):
     
        def __init__(self, name, old, new=None):
            super(MovedModule, self).__init__(name)
            if PY3:
                if new is None:
                    new = name
                self.mod = new
            else:
                self.mod = old
     
        def _resolve(self):
            return _import_module(self.mod)
     
        def __getattr__(self, attr):
            _module = self._resolve()
            value = getattr(_module, attr)
            setattr(self, attr, value)
            return value
     
     
    class _LazyModule(types.ModuleType):
     
        def __init__(self, name):
            super(_LazyModule, self).__init__(name)
            self.__doc__ = self.__class__.__doc__
     
        def __dir__(self):
            attrs = ["__doc__", "__name__"]
            attrs += [attr.name for attr in self._moved_attributes]
            return attrs
     
        # Subclasses should override this
        _moved_attributes = []
     
     
    class MovedAttribute(_LazyDescr):
     
        def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
            super(MovedAttribute, self).__init__(name)
            if PY3:
                if new_mod is None:
                    new_mod = name
                self.mod = new_mod
                if new_attr is None:
                    if old_attr is None:
                        new_attr = name
                    else:
                        new_attr = old_attr
                self.attr = new_attr
            else:
                self.mod = old_mod
                if old_attr is None:
                    old_attr = name
                self.attr = old_attr
     
        def _resolve(self):
            module = _import_module(self.mod)
            return getattr(module, self.attr)
     
     
    class _SixMetaPathImporter(object):
     
        """
        A meta path importer to import six.moves and its submodules.
     
        This class implements a PEP302 finder and loader. It should be compatible
        with Python 2.5 and all existing versions of Python3
        """
     
        def __init__(self, six_module_name):
            self.name = six_module_name
            self.known_modules = {}
     
        def _add_module(self, mod, *fullnames):
            for fullname in fullnames:
                self.known_modules[self.name + "." + fullname] = mod
     
        def _get_module(self, fullname):
            return self.known_modules[self.name + "." + fullname]
     
        def find_module(self, fullname, path=None):
            if fullname in self.known_modules:
                return self
            return None
     
        def __get_module(self, fullname):
            try:
                return self.known_modules[fullname]
            except KeyError:
                raise ImportError("This loader does not know module " + fullname)
     
        def load_module(self, fullname):
            try:
                # in case of a reload
                return sys.modules[fullname]
            except KeyError:
                pass
            mod = self.__get_module(fullname)
            if isinstance(mod, MovedModule):
                mod = mod._resolve()
            else:
                mod.__loader__ = self
            sys.modules[fullname] = mod
            return mod
     
        def is_package(self, fullname):
            """
            Return true, if the named module is a package.
     
            We need this method to get correct spec objects with
            Python 3.4 (see PEP451)
            """
            return hasattr(self.__get_module(fullname), "__path__")
     
        def get_code(self, fullname):
            """Return None
     
            Required, if is_package is implemented"""
            self.__get_module(fullname)  # eventually raises ImportError
            return None
        get_source = get_code  # same as get_code
     
    _importer = _SixMetaPathImporter(__name__)
     
     
    class _MovedItems(_LazyModule):
     
        """Lazy loading of moved objects"""
        __path__ = []  # mark as package
     
     
    _moved_attributes = [
        MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
        MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
        MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"),
        MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
        MovedAttribute("intern", "__builtin__", "sys"),
        MovedAttribute("map", "itertools", "builtins", "imap", "map"),
        MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"),
        MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"),
        MovedAttribute("getoutput", "commands", "subprocess"),
        MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"),
        MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"),
        MovedAttribute("reduce", "__builtin__", "functools"),
        MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
        MovedAttribute("StringIO", "StringIO", "io"),
        MovedAttribute("UserDict", "UserDict", "collections"),
        MovedAttribute("UserList", "UserList", "collections"),
        MovedAttribute("UserString", "UserString", "collections"),
        MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
        MovedAttribute("zip", "itertools", "builtins", "izip", "zip"),
        MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
        MovedModule("builtins", "__builtin__"),
        MovedModule("configparser", "ConfigParser"),
        MovedModule("copyreg", "copy_reg"),
        MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
        MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"),
        MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
        MovedModule("http_cookies", "Cookie", "http.cookies"),
        MovedModule("html_entities", "htmlentitydefs", "html.entities"),
        MovedModule("html_parser", "HTMLParser", "html.parser"),
        MovedModule("http_client", "httplib", "http.client"),
        MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
        MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"),
        MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
        MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"),
        MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
        MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
        MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
        MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
        MovedModule("cPickle", "cPickle", "pickle"),
        MovedModule("queue", "Queue"),
        MovedModule("reprlib", "repr"),
        MovedModule("socketserver", "SocketServer"),
        MovedModule("_thread", "thread", "_thread"),
        MovedModule("tkinter", "Tkinter"),
        MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
        MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
        MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
        MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
        MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
        MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"),
        MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
        MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
        MovedModule("tkinter_colorchooser", "tkColorChooser",
                    "tkinter.colorchooser"),
        MovedModule("tkinter_commondialog", "tkCommonDialog",
                    "tkinter.commondialog"),
        MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"),
        MovedModule("tkinter_font", "tkFont", "tkinter.font"),
        MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"),
        MovedModule("tkinter_tksimpledialog", "tkSimpleDialog",
                    "tkinter.simpledialog"),
        MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"),
        MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"),
        MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"),
        MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"),
        MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"),
        MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"),
    ]
    # Add windows specific modules.
    if sys.platform == "win32":
        _moved_attributes += [
            MovedModule("winreg", "_winreg"),
        ]
     
    for attr in _moved_attributes:
        setattr(_MovedItems, attr.name, attr)
        if isinstance(attr, MovedModule):
            _importer._add_module(attr, "moves." + attr.name)
    del attr
     
    _MovedItems._moved_attributes = _moved_attributes
     
    moves = _MovedItems(__name__ + ".moves")
    _importer._add_module(moves, "moves")
     
     
    class Module_six_moves_urllib_parse(_LazyModule):
     
        """Lazy loading of moved objects in six.moves.urllib_parse"""
     
     
    _urllib_parse_moved_attributes = [
        MovedAttribute("ParseResult", "urlparse", "urllib.parse"),
        MovedAttribute("SplitResult", "urlparse", "urllib.parse"),
        MovedAttribute("parse_qs", "urlparse", "urllib.parse"),
        MovedAttribute("parse_qsl", "urlparse", "urllib.parse"),
        MovedAttribute("urldefrag", "urlparse", "urllib.parse"),
        MovedAttribute("urljoin", "urlparse", "urllib.parse"),
        MovedAttribute("urlparse", "urlparse", "urllib.parse"),
        MovedAttribute("urlsplit", "urlparse", "urllib.parse"),
        MovedAttribute("urlunparse", "urlparse", "urllib.parse"),
        MovedAttribute("urlunsplit", "urlparse", "urllib.parse"),
        MovedAttribute("quote", "urllib", "urllib.parse"),
        MovedAttribute("quote_plus", "urllib", "urllib.parse"),
        MovedAttribute("unquote", "urllib", "urllib.parse"),
        MovedAttribute("unquote_plus", "urllib", "urllib.parse"),
        MovedAttribute("unquote_to_bytes", "urllib", "urllib.parse", "unquote", "unquote_to_bytes"),
        MovedAttribute("urlencode", "urllib", "urllib.parse"),
        MovedAttribute("splitquery", "urllib", "urllib.parse"),
        MovedAttribute("splittag", "urllib", "urllib.parse"),
        MovedAttribute("splituser", "urllib", "urllib.parse"),
        MovedAttribute("splitvalue", "urllib", "urllib.parse"),
        MovedAttribute("uses_fragment", "urlparse", "urllib.parse"),
        MovedAttribute("uses_netloc", "urlparse", "urllib.parse"),
        MovedAttribute("uses_params", "urlparse", "urllib.parse"),
        MovedAttribute("uses_query", "urlparse", "urllib.parse"),
        MovedAttribute("uses_relative", "urlparse", "urllib.parse"),
    ]
    for attr in _urllib_parse_moved_attributes:
        setattr(Module_six_moves_urllib_parse, attr.name, attr)
    del attr
     
    Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes
     
    _importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"),
                          "moves.urllib_parse", "moves.urllib.parse")
     
     
    class Module_six_moves_urllib_error(_LazyModule):
     
        """Lazy loading of moved objects in six.moves.urllib_error"""
     
     
    _urllib_error_moved_attributes = [
        MovedAttribute("URLError", "urllib2", "urllib.error"),
        MovedAttribute("HTTPError", "urllib2", "urllib.error"),
        MovedAttribute("ContentTooShortError", "urllib", "urllib.error"),
    ]
    for attr in _urllib_error_moved_attributes:
        setattr(Module_six_moves_urllib_error, attr.name, attr)
    del attr
     
    Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes
     
    _importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"),
                          "moves.urllib_error", "moves.urllib.error")
     
     
    class Module_six_moves_urllib_request(_LazyModule):
     
        """Lazy loading of moved objects in six.moves.urllib_request"""
     
     
    _urllib_request_moved_attributes = [
        MovedAttribute("urlopen", "urllib2", "urllib.request"),
        MovedAttribute("install_opener", "urllib2", "urllib.request"),
        MovedAttribute("build_opener", "urllib2", "urllib.request"),
        MovedAttribute("pathname2url", "urllib", "urllib.request"),
        MovedAttribute("url2pathname", "urllib", "urllib.request"),
        MovedAttribute("getproxies", "urllib", "urllib.request"),
        MovedAttribute("Request", "urllib2", "urllib.request"),
        MovedAttribute("OpenerDirector", "urllib2", "urllib.request"),
        MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"),
        MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"),
        MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"),
        MovedAttribute("ProxyHandler", "urllib2", "urllib.request"),
        MovedAttribute("BaseHandler", "urllib2", "urllib.request"),
        MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"),
        MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"),
        MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"),
        MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"),
        MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"),
        MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"),
        MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"),
        MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"),
        MovedAttribute("HTTPHandler", "urllib2", "urllib.request"),
        MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"),
        MovedAttribute("FileHandler", "urllib2", "urllib.request"),
        MovedAttribute("FTPHandler", "urllib2", "urllib.request"),
        MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"),
        MovedAttribute("UnknownHandler", "urllib2", "urllib.request"),
        MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"),
        MovedAttribute("urlretrieve", "urllib", "urllib.request"),
        MovedAttribute("urlcleanup", "urllib", "urllib.request"),
        MovedAttribute("URLopener", "urllib", "urllib.request"),
        MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
        MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
        MovedAttribute("parse_http_list", "urllib2", "urllib.request"),
        MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"),
    ]
    for attr in _urllib_request_moved_attributes:
        setattr(Module_six_moves_urllib_request, attr.name, attr)
    del attr
     
    Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes
     
    _importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"),
                          "moves.urllib_request", "moves.urllib.request")
     
     
    class Module_six_moves_urllib_response(_LazyModule):
     
        """Lazy loading of moved objects in six.moves.urllib_response"""
     
     
    _urllib_response_moved_attributes = [
        MovedAttribute("addbase", "urllib", "urllib.response"),
        MovedAttribute("addclosehook", "urllib", "urllib.response"),
        MovedAttribute("addinfo", "urllib", "urllib.response"),
        MovedAttribute("addinfourl", "urllib", "urllib.response"),
    ]
    for attr in _urllib_response_moved_attributes:
        setattr(Module_six_moves_urllib_response, attr.name, attr)
    del attr
     
    Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes
     
    _importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"),
                          "moves.urllib_response", "moves.urllib.response")
     
     
    class Module_six_moves_urllib_robotparser(_LazyModule):
     
        """Lazy loading of moved objects in six.moves.urllib_robotparser"""
     
     
    _urllib_robotparser_moved_attributes = [
        MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"),
    ]
    for attr in _urllib_robotparser_moved_attributes:
        setattr(Module_six_moves_urllib_robotparser, attr.name, attr)
    del attr
     
    Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes
     
    _importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"),
                          "moves.urllib_robotparser", "moves.urllib.robotparser")
     
     
    class Module_six_moves_urllib(types.ModuleType):
     
        """Create a six.moves.urllib namespace that resembles the Python 3 namespace"""
        __path__ = []  # mark as package
        parse = _importer._get_module("moves.urllib_parse")
        error = _importer._get_module("moves.urllib_error")
        request = _importer._get_module("moves.urllib_request")
        response = _importer._get_module("moves.urllib_response")
        robotparser = _importer._get_module("moves.urllib_robotparser")
     
        def __dir__(self):
            return ['parse', 'error', 'request', 'response', 'robotparser']
     
    _importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"),
                          "moves.urllib")
     
     
    def add_move(move):
        """Add an item to six.moves."""
        setattr(_MovedItems, move.name, move)
     
     
    def remove_move(name):
        """Remove item from six.moves."""
        try:
            delattr(_MovedItems, name)
        except AttributeError:
            try:
                del moves.__dict__[name]
            except KeyError:
                raise AttributeError("no such move, %r" % (name,))
     
     
    if PY3:
        _meth_func = "__func__"
        _meth_self = "__self__"
     
        _func_closure = "__closure__"
        _func_code = "__code__"
        _func_defaults = "__defaults__"
        _func_globals = "__globals__"
    else:
        _meth_func = "im_func"
        _meth_self = "im_self"
     
        _func_closure = "func_closure"
        _func_code = "func_code"
        _func_defaults = "func_defaults"
        _func_globals = "func_globals"
     
     
    try:
        advance_iterator = next
    except NameError:
        def advance_iterator(it):
            return it.next()
    next = advance_iterator
     
     
    try:
        callable = callable
    except NameError:
        def callable(obj):
            return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
     
     
    if PY3:
        def get_unbound_function(unbound):
            return unbound
     
        create_bound_method = types.MethodType
     
        def create_unbound_method(func, cls):
            return func
     
        Iterator = object
    else:
        def get_unbound_function(unbound):
            return unbound.im_func
     
        def create_bound_method(func, obj):
            return types.MethodType(func, obj, obj.__class__)
     
        def create_unbound_method(func, cls):
            return types.MethodType(func, None, cls)
     
        class Iterator(object):
     
            def next(self):
                return type(self).__next__(self)
     
        callable = callable
    _add_doc(get_unbound_function,
             """Get the function out of a possibly unbound function""")
     
     
    get_method_function = operator.attrgetter(_meth_func)
    get_method_self = operator.attrgetter(_meth_self)
    get_function_closure = operator.attrgetter(_func_closure)
    get_function_code = operator.attrgetter(_func_code)
    get_function_defaults = operator.attrgetter(_func_defaults)
    get_function_globals = operator.attrgetter(_func_globals)
     
     
    if PY3:
        def iterkeys(d, **kw):
            return iter(d.keys(**kw))
     
        def itervalues(d, **kw):
            return iter(d.values(**kw))
     
        def iteritems(d, **kw):
            return iter(d.items(**kw))
     
        def iterlists(d, **kw):
            return iter(d.lists(**kw))
     
        viewkeys = operator.methodcaller("keys")
     
        viewvalues = operator.methodcaller("values")
     
        viewitems = operator.methodcaller("items")
    else:
        def iterkeys(d, **kw):
            return d.iterkeys(**kw)
     
        def itervalues(d, **kw):
            return d.itervalues(**kw)
     
        def iteritems(d, **kw):
            return d.iteritems(**kw)
     
        def iterlists(d, **kw):
            return d.iterlists(**kw)
     
        viewkeys = operator.methodcaller("viewkeys")
     
        viewvalues = operator.methodcaller("viewvalues")
     
        viewitems = operator.methodcaller("viewitems")
     
    _add_doc(iterkeys, "Return an iterator over the keys of a dictionary.")
    _add_doc(itervalues, "Return an iterator over the values of a dictionary.")
    _add_doc(iteritems,
             "Return an iterator over the (key, value) pairs of a dictionary.")
    _add_doc(iterlists,
             "Return an iterator over the (key, [values]) pairs of a dictionary.")
     
     
    if PY3:
        def b(s):
            return s.encode("latin-1")
     
        def u(s):
            return s
        unichr = chr
        import struct
        int2byte = struct.Struct(">B").pack
        del struct
        byte2int = operator.itemgetter(0)
        indexbytes = operator.getitem
        iterbytes = iter
        import io
        StringIO = io.StringIO
        BytesIO = io.BytesIO
        _assertCountEqual = "assertCountEqual"
        if sys.version_info[1] <= 1:
            _assertRaisesRegex = "assertRaisesRegexp"
            _assertRegex = "assertRegexpMatches"
        else:
            _assertRaisesRegex = "assertRaisesRegex"
            _assertRegex = "assertRegex"
    else:
        def b(s):
            return s
        # Workaround for standalone backslash
     
        def u(s):
            return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
        unichr = unichr
        int2byte = chr
     
        def byte2int(bs):
            return ord(bs[0])
     
        def indexbytes(buf, i):
            return ord(buf[i])
        iterbytes = functools.partial(itertools.imap, ord)
        import StringIO
        StringIO = BytesIO = StringIO.StringIO
        _assertCountEqual = "assertItemsEqual"
        _assertRaisesRegex = "assertRaisesRegexp"
        _assertRegex = "assertRegexpMatches"
    _add_doc(b, """Byte literal""")
    _add_doc(u, """Text literal""")
     
     
    def assertCountEqual(self, *args, **kwargs):
        return getattr(self, _assertCountEqual)(*args, **kwargs)
     
     
    def assertRaisesRegex(self, *args, **kwargs):
        return getattr(self, _assertRaisesRegex)(*args, **kwargs)
     
     
    def assertRegex(self, *args, **kwargs):
        return getattr(self, _assertRegex)(*args, **kwargs)
     
     
    if PY3:
        exec_ = getattr(moves.builtins, "exec")
     
        def reraise(tp, value, tb=None):
            try:
                if value is None:
                    value = tp()
                if value.__traceback__ is not tb:
                    raise value.with_traceback(tb)
                raise value
            finally:
                value = None
                tb = None
     
    else:
        def exec_(_code_, _globs_=None, _locs_=None):
            """Execute code in a namespace."""
            if _globs_ is None:
                frame = sys._getframe(1)
                _globs_ = frame.f_globals
                if _locs_ is None:
                    _locs_ = frame.f_locals
                del frame
            elif _locs_ is None:
                _locs_ = _globs_
            exec("""exec _code_ in _globs_, _locs_""")
     
        exec_("""def reraise(tp, value, tb=None):
        try:
            raise tp, value, tb
        finally:
            tb = None
    """)
     
     
    if sys.version_info[:2] == (3, 2):
        exec_("""def raise_from(value, from_value):
        try:
            if from_value is None:
                raise value
            raise value from from_value
        finally:
            value = None
    """)
    elif sys.version_info[:2] > (3, 2):
        exec_("""def raise_from(value, from_value):
        try:
            raise value from from_value
        finally:
            value = None
    """)
    else:
        def raise_from(value, from_value):
            raise value
     
     
    print_ = getattr(moves.builtins, "print", None)
    if print_ is None:
        def print_(*args, **kwargs):
            """The new-style print function for Python 2.4 and 2.5."""
            fp = kwargs.pop("file", sys.stdout)
            if fp is None:
                return
     
            def write(data):
                if not isinstance(data, basestring):
                    data = str(data)
                # If the file has an encoding, encode unicode with it.
                if (isinstance(fp, file) and
                        isinstance(data, unicode) and
                        fp.encoding is not None):
                    errors = getattr(fp, "errors", None)
                    if errors is None:
                        errors = "strict"
                    data = data.encode(fp.encoding, errors)
                fp.write(data)
            want_unicode = False
            sep = kwargs.pop("sep", None)
            if sep is not None:
                if isinstance(sep, unicode):
                    want_unicode = True
                elif not isinstance(sep, str):
                    raise TypeError("sep must be None or a string")
            end = kwargs.pop("end", None)
            if end is not None:
                if isinstance(end, unicode):
                    want_unicode = True
                elif not isinstance(end, str):
                    raise TypeError("end must be None or a string")
            if kwargs:
                raise TypeError("invalid keyword arguments to print()")
            if not want_unicode:
                for arg in args:
                    if isinstance(arg, unicode):
                        want_unicode = True
                        break
            if want_unicode:
                newline = unicode("\n")
                space = unicode(" ")
            else:
                newline = "\n"
                space = " "
            if sep is None:
                sep = space
            if end is None:
                end = newline
            for i, arg in enumerate(args):
                if i:
                    write(sep)
                write(arg)
            write(end)
    if sys.version_info[:2] < (3, 3):
        _print = print_
     
        def print_(*args, **kwargs):
            fp = kwargs.get("file", sys.stdout)
            flush = kwargs.pop("flush", False)
            _print(*args, **kwargs)
            if flush and fp is not None:
                fp.flush()
     
    _add_doc(reraise, """Reraise an exception.""")
     
    if sys.version_info[0:2] < (3, 4):
        def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
                  updated=functools.WRAPPER_UPDATES):
            def wrapper(f):
                f = functools.wraps(wrapped, assigned, updated)(f)
                f.__wrapped__ = wrapped
                return f
            return wrapper
    else:
        wraps = functools.wraps
     
     
    def with_metaclass(meta, *bases):
        """Create a base class with a metaclass."""
        # This requires a bit of explanation: the basic idea is to make a dummy
        # metaclass for one level of class instantiation that replaces itself with
        # the actual metaclass.
        class metaclass(type):
     
            def __new__(cls, name, this_bases, d):
                return meta(name, bases, d)
     
            @classmethod
            def __prepare__(cls, name, this_bases):
                return meta.__prepare__(name, bases)
        return type.__new__(metaclass, 'temporary_class', (), {})
     
     
    def add_metaclass(metaclass):
        """Class decorator for creating a class with a metaclass."""
        def wrapper(cls):
            orig_vars = cls.__dict__.copy()
            slots = orig_vars.get('__slots__')
            if slots is not None:
                if isinstance(slots, str):
                    slots = [slots]
                for slots_var in slots:
                    orig_vars.pop(slots_var)
            orig_vars.pop('__dict__', None)
            orig_vars.pop('__weakref__', None)
            return metaclass(cls.__name__, cls.__bases__, orig_vars)
        return wrapper
     
     
    def python_2_unicode_compatible(klass):
        """
        A decorator that defines __unicode__ and __str__ methods under Python 2.
        Under Python 3 it does nothing.
     
        To support Python 2 and 3 with a single code base, define a __str__ method
        returning text and apply this decorator to the class.
        """
        if PY2:
            if '__str__' not in klass.__dict__:
                raise ValueError("@python_2_unicode_compatible cannot be applied "
                                 "to %s because it doesn't define __str__()." %
                                 klass.__name__)
            klass.__unicode__ = klass.__str__
            klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
        return klass
     
     
    # Complete the moves implementation.
    # This code is at the end of this module to speed up module loading.
    # Turn this module into a package.
    __path__ = []  # required for PEP 302 and PEP 451
    __package__ = __name__  # see PEP 366 @ReservedAssignment
    if globals().get("__spec__") is not None:
        __spec__.submodule_search_locations = []  # PEP 451 @UndefinedVariable
    # Remove other six meta path importers, since they cause problems. This can
    # happen if six is removed from sys.modules and then reloaded. (Setuptools does
    # this for some reason.)
    if sys.meta_path:
        for i, importer in enumerate(sys.meta_path):
            # Here's some real nastiness: Another "instance" of the six module might
            # be floating around. Therefore, we can't use isinstance() to check for
            # the six meta path importer, since the other six instance will have
            # inserted an importer with different class.
            if (type(importer).__name__ == "_SixMetaPathImporter" and
                    importer.name == __name__):
                del sys.meta_path[i]
                break
        del i, importer
    # Finally, add the importer to the meta path import hook.
    sys.meta_path.append(_importer)


    mais voila ce code ne semble pas fonctionner sous python3.6

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    >>> Exception "unhandled ModuleNotFoundError"
    No module named 'tkinter'
    File: /home/userxxxxxx/.local/lib/python3.6/site-packages/six.py, Line: 82

    https://stackoverflow.com/questions/...lib-table-only

    - plt.savefig("toto.pdf")

    voila par contre une chose plustot interessante

    http://cours-info.iut-bm.univ-fcomte...thon/Reportlab

  4. #4
    Expert confirmé
    Avatar de tyrtamos
    Homme Profil pro
    Retraité
    Inscrit en
    Décembre 2007
    Messages
    4 486
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2007
    Messages : 4 486
    Billets dans le blog
    6
    Par défaut
    Bonjour,

    Il est aussi possible de créer des pdf à partir de html avec la bibliothèque graphique PyQt. Il y a une petite restriction cependant, PyQt ne comprend pas tout le html mais seulement un sous-ensemble qu'il appelle le "richtext" (http://doc.qt.io/qt-5/richtext-html-subset.html). Ce sous-ensemble est cependant assez complet pour créer de belles pages avec de beaux textes, des images, des tableaux, des listes arborescentes indentées, etc...

    A titre d'exemple, je viens de répondre sur ce sujet sur le sous-forum PyQt: comment créer des fichiers pdf multipages avec entêtes et bas de pages:
    https://www.developpez.net/forums/d1...l/#post9762503.

  5. #5
    Membre éclairé Avatar de dedalios
    Homme Profil pro
    concepteur d'application
    Inscrit en
    Février 2008
    Messages
    495
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : concepteur d'application
    Secteur : Santé

    Informations forums :
    Inscription : Février 2008
    Messages : 495
    Par défaut Reportllab
    Bonjour voici test.

    Dans ce test je cherche a créer un changement de page entre le titre et le corps du texte.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
     
    # coding: utf-8 
     
     
    import datetime
    from reportlab.lib.pagesizes import A4
    from reportlab.lib.units import cm
     
    from reportlab.platypus import Paragraph, SimpleDocTemplate, Spacer
    from reportlab.lib.styles import getSampleStyleSheet
    from reportlab.lib.styles import ParagraphStyle as feuille_de_style
     
    from reportlab.pdfbase import pdfmetrics , ttfonts
    from reportlab.pdfbase.cidfonts import UnicodeCIDFont
     
     
    from reportlab.lib import colors
    from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate, NextPageTemplate, Paragraph, PageBreak, Table, \
        TableStyle
    from reportlab.lib.enums import TA_CENTER, TA_LEFT,TA_RIGHT,TA_JUSTIFY
     
    from reportlab.lib.colors import blueviolet, black, darkorange, orange, blue,\
        deepskyblue
    from _blake2 import blake2b
     
    if __name__ == '__main__':
            aujourdhui = datetime.datetime.today()
            story_pdf = [] # document pdf
     
            docpdf = SimpleDocTemplate("nom_fichier.pdf",pagesize = A4,
                title = "nom_fichier.pdf",
                author = 'Dedalios' ) # Signature du fichier auteur....
     
            # construction des styles
            styles = getSampleStyleSheet()
            styleN = styles['Normal']        # Définition de base de la polices normale
            styleT = styles['Title']         # Définition titre
            styleH = styles['Heading1']      # Définition h1
            styleH2 = styles['Heading2']     # Définition h2
     
            styleT2= feuille_de_style(
            name = 'CORPS',
            fontName='Helvetica',
            fontSize=16,
            leading=14,
            alignment=TA_CENTER,
            backColor=darkorange,
            textColor=deepskyblue,
            borderColor=black,
            borderWidth=1,
            borderPadding=5,
            borderRadius=2,
            spaceBefore=10,
            spaceAfter=10,) #version de style a un encadrement  , l'interrieur du cadre est orange
     
            # Titre du document
            titre_l1 ="Fichier:  nom_fichier.pdf"
            titre_l2 ="Fait le :  " + str(aujourdhui)
     
             # injection du titre dans le document
            story_pdf.append(Paragraph( titre_l1  ,styleT2))
            story_pdf.append(Paragraph(titre_l2 ,styleT2))
            story_pdf.append(Spacer(0, cm * .5))   
            # Corps du test
            Corps_du_texte ="Bonjour à tous\n " \
            + "Il fait beau en cette date\n" \
            + " Alons nous promener"
     
            #Injection du corps de texte dans le document
            paragraphs = Corps_du_texte.split("\n")
            for para in paragraphs:
                story_pdf.append(Paragraph(para, styleN  ))
                story_pdf.append(Spacer(0, cm * .3))
     
            # Sauvengarde le dpdf
            docpdf.build(story_pdf)
    Le paragraphe du titre fait apparaitre 2 cadres construit par ces lignes de code , mais voilà j’aimerai avoir le cadre autre des 2 textes avec l'interligne définie dans le spacer .


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
            # Titre du document
            titre_l1 ="Fichier:  nom_fichier.pdf"
            titre_l2 ="Fait le :  " + str(aujourdhui)
     
             # injection du titre dans le document
            story_pdf.append(Paragraph( titre_l1  ,styleT2)) 
            story_pdf.append(Paragraph(titre_l2 ,styleT2))
            story_pdf.append(Spacer(0, cm * .5))
    Si je passe sur cette version

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
            # Titre du document
            titre_l1 ="Fichier:  nom_fichier.pdf \n"\
            "Fait le :  " + str(aujourdhui)
     
             # injection du titre dans le document
            story_pdf.append(Paragraph( titre_l1  ,styleT2)) 
             story_pdf.append(Spacer(0, cm * .5))
    le caractère de passage à la ligne "\n" n'est pas interprété comme tel par reportlabnom_fichier.pdf

    Puis dans la partie suivante il le corps du texte, mais comment effectuer une pagination forcer entre ses 2 éléments

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
           #Injection du corps de texte dans le document
            paragraphs = Corps_du_texte.split("\n")
            for para in paragraphs:
                story_pdf.append(Paragraph(para, styleN  ))
                story_pdf.append(Spacer(0, cm * .3))
    Le pdf de résultat est en pièce jointe Pièce jointe 328387





    Voici la construction d'un style (il y a certainement des points de détail à améliorer).

    Couleur intérieur du cadre = darkorange
    Couleur de la bordure = noir
    Couleur du texte =deepskyblue
    Alignement : fait référence à
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    from reportlab.lib.enums import TA_CENTER, TA_LEFT,TA_RIGHT,TA_JUSTIFY
    Par défaut encadrement à gauche si le paramètre n'est pas définie dans la construction d'un style
    Largeur de bordure = 1
    marge de remplissage(borderPadding) = 5
    rayon de la frontière = 2
    espace Avant = 10
    espace Après = 10



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
             styleT2= feuille_de_style(
            name = 'CORPS',
            fontName='Helvetica',
            fontSize=16,
            leading=14,
            alignment=TA_CENTER,
            backColor=darkorange,
            textColor=deepskyblue,
            borderColor=black,
            borderWidth=1,
            borderPadding=5,
            borderRadius=2,
            spaceBefore=10,
            spaceAfter=10,)

  6. #6
    Membre éclairé Avatar de dedalios
    Homme Profil pro
    concepteur d'application
    Inscrit en
    Février 2008
    Messages
    495
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : concepteur d'application
    Secteur : Santé

    Informations forums :
    Inscription : Février 2008
    Messages : 495
    Par défaut
    Je viens de trouver une partie de la réponse mes questions

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
       story_pdf.append(PageBreak())
    Voici les modalités minimalistes de pagination

Discussions similaires

  1. Creation de fichier PDF
    Par Faith's Fall dans le forum Autres Logiciels
    Réponses: 8
    Dernier message: 26/08/2009, 19h05
  2. Réponses: 1
    Dernier message: 30/03/2009, 16h09
  3. [MySQL] creation Fichier pdf avec php
    Par toulousain3117 dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 14/11/2008, 14h48
  4. creation pdf avec macro et autres
    Par ingoenius dans le forum Programmation (La)TeX avancée
    Réponses: 0
    Dernier message: 21/03/2008, 15h00
  5. Pb Creation PDF avec PDFCreator apres impression dans fichier PRN
    Par asimut dans le forum VB 6 et antérieur
    Réponses: 0
    Dernier message: 11/09/2007, 17h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo