kamagra 30 kapsuli

The CleanPrint API allows developers to interact with the CleanPrint engine directly. This means passing a URL of an article, and getting that same article back reformatted by CleanPrint. The CleanPrint API has been configured to work with multiple programing languages, choose the one that fits your needs below.

An API Keys is required to acces the CleanPrint API. You can register for one here.

Before using the CleanPrint API, please read over the Terms of Service.

Download the Java SDK CleanPrint Java SDK

CleanPrint API to convert the content specified by a URL to its CleanPrint’ed output. For example to generate a file name foobar-baz.html from the URL: http://foo.bar.com/baz you do the following:

1
2
3
4
5
6
URL url = new URL("http://foobar.com/baz");
OutputStream os = new FileOutputStream("foobar-baz.html");
CleanPrint cleanPrint = new CleanPrint(url, "My-Developer-Key");

cleanPrint.generate(CleanPrint.OutputFormat.HTML, os);
os.close();

Nested Class Summary
static class CleanPrint.OutputFormat
Specifies the desired output format
static class CleanPrint.PageSize
Specifies the desired page size
Constructor Summary
CleanPrint(java.net.URL url, java.lang.String key)
Constructor specifying the remote URL and the API key.
Method Summary
void generate(CleanPrint.OutputFormat outputFormat, java.io.OutputStream os)
Generate the desired content for the specified output type and desired page size
static void main(java.lang.String[] args)
Can be executed as an application
void setReader(java.io.Reader reader)
Specify the remote HTML content via a Reader [Optional]
void setPageSize(CleanPrint.PageSize pageSize)
Set the page size [Optional]
Constructor Detail

CleanPrint

1
public CleanPrint(java.net.URL url, java.lang.String apiKey) throws java.lang.Exception

Constructor specifying the remote URL and the developer API key

Parameters:
url – URL referencing remote content
key – developer API key

Throws:
java.lang.Exception

Method Detail

setReader

1
public void setReader(java.io.Reader reader)

Specify the remote content via a Reader [Optional]. This should only be used when the URL cannot be fetched externally or when the content is dynamically generated.

NOTE: The caller is responsible for closing the Reader.

Parameters:
reader – Reader for the incoming content


setPageSize

1
public void setPageSize(CleanPrint.PageSize pageSize)

Set the page size [Optional]. Defaults to U.S. Letter when this method isn’t used.

Parameters:
pageSize – size of desired paper


generate

1
public void generate(CleanPrint.OutputFormat outputFormat, java.io.OutputStream os) throws java.lang.Exception

Generate the desired content for the specified output type and desired page size

NOTE: The caller is responsible for closing the OutputStream.

Parameters:
outputFormat – the desired output format
os – the OutputStream where the content should be written to

Throws:
java.lang.Exception – For any of the following:

  • URL cannot be fetched (this can be very misleading)
  • Content cannot be fetched from the InputStream [when setInputStream is used]
  • The OutputStream cannot be written to

main

1
public static void main(java.lang.String[] args) throws java.lang.Exception

Can be executed as an application. Run without arguments for syntax.

Throws:
java.lang.Exception

Link to full Java doc Java Doc

The CleanPrint API may be accessed in a Web/REST manner using simple URLs.

Base URL: http://cpf.cleanprint.net/cpf/api

Required URL parameters (all values must be URL encoded):

  • key – Developer API key
  • url – URL to the source article
  • type – output format, must be one of the following:
    • text/html
    • application/pdf
    • text/rtf

Optional parameters

  • page – the page size and orientation (append the word landscape, e.g. a4 landscape)
    • letter (this is the default when unset)
    • government_letter
    • index_3x5
    • index_4x6
    • index_5x8
    • junior_legal
    • legal
    • ledger (17”x11”)
    • tabloid (11”x17”)
    • foolscap_folio (8.5”x13.5”)
    • monarch (7.25”x10.5”)
    • quarto (8”x10”)
    • Entire A series (e.g. a0)
    • Entire B series
  • images – Enables or disables the inclusion of images:
    • true (default when unset)
    • false
  • color – Specifies the desired color of text and images:
    • color – full color images and text (default when unset)
    • grayscale – Gray-scaled images and black text
    • lessink – Subdued text color and gray images

For example:

http://cpf.cleanprint.net/cpf/api?key=myDeveloperKey&url=http://www.formatdynamics.com/cleanprint-api&type=text/html

Errors:
If a parameter is missing or incorrectly specified the resulting HTTP error text will alert you to the issue.

CleanPrint HTML styling IDs and classes:

The following IDs and class names can be used to locate and/or re-style content in the HTML output (re-styling PDF and RTF is currently unavailable).

  • cpf-printOut-header-title
  • cpf-printOut-header-byline
  • cpf-printOut-header-dateline
  • cpf-printOut-body-content
  • cpf-printOut-body-content-img-container
  • cpf-printOut-footer-copyright
Download the IOS static libraryCleanPrint IOS static library

CleanPrint API to convert the content specified by a URL to its CleanPrint’ed output.

For example to generate a file name foobar-baz.html from the URL: http://foo.bar.com/baz you do the following:

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
NSURL *theUrl = [NSURL URLWithString:"http://foobar.com/baz"];
NSString *theKey = @"My-Developer-Key";
NSString *path = @"/temp/foobar-baz.html";
NSError *theError = nil; 
NSOutputStream *oStream = [[NSOutputStream alloc] initToFileAtPath:path append:shouldAppend];

[oStream retain]; 
[oStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; 
[oStream open];

FDCleanPrint *cp = [[FDCleanPrint alloc] initWithUrl:theUrl AndKey:theKey Error:&theError];

if (theError) { NSLog("%", [theError localizedDescription]); return [theError code]; }

[cp generate:HTML ToStream: oStream Error:&theError];

if (theError) { NSLog("%", [theError localizedDescription]); return [theError code]; }

[oStream close]; 
[oStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];

[oStream release]; 
oStream = nil;

[cp dealloc];

Method Documentation
- (void) dealloc Cleanup the CleanPrint instance
- (NSString *) description Return the description

- (id) generate: (OutputFormat) theOutputFormat
ToStream: (NSOutputStream*) theOutputStream
Error: (NSError**) theError
Generate the desired content for the specified |theOutputFormat| and write it to |theOutputStream|. |theError| is a double pointer to an NSError which is populated on error. NOTE: The caller is responsible for closing |theOutputStream|
- (id) initWithUrl: (NSURL*) theUrl
AndKey: (NSString*) theKey
Error: (NSError**) theError
Designated initializer. Returns an instance of CleanPrint. |theUrl| is the url of the article you want to CleanPrint. |theKey| is your Developer API Key. |theError| is a double pointer to an NSError which is populated on error.
- (id) setFontSize: (NSString*) theFontSize
Error: (NSError**) theError
Sets |theFontSize| |theError| is a double pointer to an NSError which is populated on error.
- (id) setPageSize: (PageSize) thePageSize
Error: (NSError**) theError
Sets |theInputStream| and |theEncoding| Sets |thePageSize| |theError| is a double pointer to an NSError which is populated on error.
- (id) setShowImages: (BOOL) theShowImages
Error: (NSError**) theError
Sets |theShowImages| |theError| is a double pointer to an NSError which is populated on error.
- (void) usage Write out the usage

Link to full IOS doc IOS Doc