This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# DRF-PDF
[![Documentation Status](https://readthedocs.org/projects/drf-pdf/badge/?version=latest)](https://readthedocs.org/projects/drf-pdf/?badge=latest)
[![Build Status](https://travis-ci.org/drgarcia1986/drf-pdf.svg?branch=master)](https://travis-ci.org/drgarcia1986/drf-pdf)
[![Coverage Status](https://coveralls.io/repos/drgarcia1986/drf-pdf/badge.svg)](https://coveralls.io/r/drgarcia1986/drf-pdf)
[![Code Health](https://landscape.io/github/drgarcia1986/drf-pdf/master/landscape.svg?style=plastic)](https://landscape.io/github/drgarcia1986/drf-pdf/master)

A simple PDF utils for Django Rest Framework

## Install

```
pip install drf-pdf
```

## Example

```python
# coding: utf - 8
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView

from drf_pdf.renderer import PDFRenderer

from my_pdf_package import PDFGenerator


class PDFHandler(APIView):

renderer_classes = (PDFRenderer, )

def get(self, request):
pdf = PDFGenerator('foo')
headers = {
'Content-Disposition': 'filename="foo.pdf"',
'Content-Length': len(pdf),
}

return Response(
pdf,
headers=headers,
status=status.HTTP_200_OK
)
```

### With two or more renderer_classes


```python
# coding: utf - 8
from rest_framework import status
from rest_framework.response import Response
from rest_framework.renderers import JSONRenderer
from rest_framework.views import APIView

from drf_pdf.response import PDFResponse
from drf_pdf.renderer import PDFRenderer

from my_pdf_package import get_pdf


class PDFHandler(APIView):

renderer_classes = (PDFRenderer, JSONRenderer)

def get(self, request, pdf_id):
pdf = get_pdf(pdf_id)
if not pdf:
return Response(
{'error': 'Not found'},
status=status.HTTP_404_NOT_FOUND
)

return PDFResponse(
pdf=pdf,
file_name=pdf_id,
status=status.HTTP_200_OK
)
```
Release History

Release History

0.2.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
drf-pdf-0.2.0.tar.gz (4.5 kB) Copy SHA256 Checksum SHA256 Source May 6, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting